![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | ServiceHost BaseAddress annoying situation in January CTP release Hi all, I have been working only with the November release until the release of the January version. After doing the needed changes, I ran my program (windows console self hosted service) without any exception (phew!!). Just then, when I tried to check everything was fine by visiting the address of the service I received the following xml as I were downloading a file: <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing"> <s:Header> <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2004/08/addressing/fault</a:Action> <a:To s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To> </s:Header> <s:Body> <s:Fault> <s:Code> <s:Value>s:Sender</s:Value> <s:Subcode> <s:Value>a:ActionNotSupported</s:Value> </s:Subcode> </s:Code> <s:Reason> <s:Text xml:lang="es-ES">The message with action '' cannot be processed at the receiver.</s:Text> </s:Reason> </s:Fault> </s:Body> </s:Envelope> After a "bit" of reviewing January samples and coding a fool service from scratch, I noticed that: - Although in the contructor of ServiceHost it is optional to supply addresses, it does NOT make the service attend to the endpoint address specified in the config file. If you debug and watch the servihost object you have just created, it has correctly your specified endpoint (with its address) but there is 0 addresses in its BaseAddresses properties. That implies the xml error file cited above. - If you code as on the samples and many other code on the inet, and put your address as a key in the appsettings section of the config file, and when creating the servicehost you retrieve and pass that address, everything works fine. Your not modified endpoint is there, and now BaseAddresses contains the address. IMHO this is an annoying behavior. Is the intended coding behavior to put addresses in appsettings as it is in the samples? Or add them to BaseAddresses after the creation of the servicehost (tested and works)? If there is a way to create a ServiceHost just from the info specified in the <system.serviceModel> section, I will be very pleased to know about it. Best regards. |
| | #2 (permalink) |
| Guest | Re: ServiceHost BaseAddress annoying situation in January CTP release Ok, we need to separate a few things out here ![]() a) ServiceHost is the "home" for a particular service and can host one or multiple endpoints that are added to the service host through configuration or at runtime. b) The base address is nothing more than a convenience feature so that you can specify a relative address for an endpoint such as "/myservice/myep" in the endpoint configuration or when using ServiceHost.AddServiceEndpoint(). The base address gives you a central place where you can set the common base addresses for all endpoints and for the transports you'd like to use (eg. http://myserver) so that you don't have to do that all the time AND because the base address is, unlike the relative service addresses, typically machine specific unless you use localhost. After the endpoints have been constructed and openend and the service is running, the base addresses don't really mean anything anymore. Did that help? Clemens "Jose Antonio" <JoseAntonio@discussions.microsoft.com> wrote in message news:B384DE9B-B4B3-4758-8545-2D4E9F11F328@microsoft.com... > Hi all, > > I have been working only with the November release until the release of > the > January version. After doing the needed changes, I ran my program (windows > console self hosted service) without any exception (phew!!). > Just then, when I tried to check everything was fine by visiting the > address > of the service I received the following xml as I were downloading a file: > <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" > xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing"> > <s:Header> > <a:Action > s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2004/08/addressing/fault</a:Action> > <a:To > s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To> > </s:Header> > <s:Body> > <s:Fault> > <s:Code> > <s:Value>s:Sender</s:Value> > <s:Subcode> > <s:Value>a:ActionNotSupported</s:Value> > </s:Subcode> > </s:Code> > <s:Reason> > <s:Text xml:lang="es-ES">The message with action '' cannot be processed > at > the receiver.</s:Text> > </s:Reason> > </s:Fault> > </s:Body> > </s:Envelope> > > After a "bit" of reviewing January samples and coding a fool service from > scratch, I noticed that: > - Although in the contructor of ServiceHost it is optional to supply > addresses, it does NOT make the service attend to the endpoint address > specified in the config file. If you debug and watch the servihost object > you > have just created, it has correctly your specified endpoint (with its > address) but there is 0 addresses in its BaseAddresses properties. That > implies the xml error file cited above. > - If you code as on the samples and many other code on the inet, and put > your address as a key in the appsettings section of the config file, and > when > creating the servicehost you retrieve and pass that address, everything > works > fine. Your not modified endpoint is there, and now BaseAddresses contains > the > address. > > IMHO this is an annoying behavior. Is the intended coding behavior to put > addresses in appsettings as it is in the samples? Or add them to > BaseAddresses after the creation of the servicehost (tested and works)? > > If there is a way to create a ServiceHost just from the info specified in > the <system.serviceModel> section, I will be very pleased to know about > it. > > Best regards. |
| | #3 (permalink) |
| Guest | Re: ServiceHost BaseAddress annoying situation in January CTP release Thanks for the answer Clemens. Although now it is clearer for me the meaning of the BaseAddresses property, I still having doubts. The constructor of the ServiceHost says it is optional to pass addresses as parameter; my endpoint definition in the config file has an absolute URI; therefore, if all it needs is there, why one has to put extra code to pass an address to the ServiceHost constructor? Why the Open method not raise an exception because there is not a base address for the service? Why if one type the endpoint address where the service should be listening gets that meaningless response (see the first post of this thread)? Well, I think I liked more the way this worked in the November release :,( . Nevertheless, a beta is a beta and now we are closer to the final release ![]() PD: I hope this questions don't sound very aggresive or rude; if so, excuse me because I don't speak english so well in order to notice that. |
| | #4 (permalink) |
| Guest | Re: ServiceHost BaseAddress annoying situation in January CTP release If you use absolute addresses in config, the base address is meaningless. The base address is only used to compose the full service address if the endpoint address is relative. Small related experiment: base address --v ep address --v Uri uriA = new Uri(new Uri("http;//myserver/bar"), "/foo"); Uri uriB = new Uri(new Uri("http;//myserver/bar"), "http;//myserver/boo/baz"); (mind the semicolons behind http, change those to ":" ... fooling the news reader's automatic link formatting) And, no, you don't sound rude and even if you ever did ... I can take it. ;-) "Jose Antonio" <JoseAntonio@discussions.microsoft.com> wrote in message news:0874280C-1126-4376-BCAD-E3B1EDFB7B29@microsoft.com... > Thanks for the answer Clemens. Although now it is clearer for me the > meaning > of the BaseAddresses property, I still having doubts. > The constructor of the ServiceHost says it is optional to pass addresses > as > parameter; my endpoint definition in the config file has an absolute URI; > therefore, if all it needs is there, why one has to put extra code to pass > an > address to the ServiceHost constructor? > Why the Open method not raise an exception because there is not a base > address for the service? > Why if one type the endpoint address where the service should be listening > gets that meaningless response (see the first post of this thread)? > > Well, I think I liked more the way this worked in the November release > :,( . > Nevertheless, a beta is a beta and now we are closer to the final release > ![]() > > PD: I hope this questions don't sound very aggresive or rude; if so, > excuse > me because I don't speak english so well in order to notice that. |
| |
| |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Vista release on January the 30th | Jon Acord | Vista General | 2 | 01-20-2007 10:12 AM |