Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / May 2005

Tip: Looking for answers? Try searching our database.

Adding SoapReceivers for runtime-added IPs

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wouter Demuynck - 25 May 2005 13:44 GMT
Hi,

I have a Windows Service which is hosting a WSE web service over TCP
(WSE 2.0 SP3).
On startup, I call this code for each of the available IP addresses:

Uri address = new Uri("urn:MyService");
Uri via = new Uri("soap.tcp://<ip address>:<port>");
EndpointReference epr = new EndpointReference(address, via);
SoapReceivers.Add(epr, webService);

This way, requests can enter via any of the IPs assigned to the server.
(If there is a way to do this without specifying each IP address
seperately, I'd really love to know)

The Windows service is intended to be running 24/7, with the
possibility of new IP addresses being added at runtime. On these newly
added IP addresses, the web service must also be available.

I tried calling SoapReceivers.Add(...) for the new ip address after it
was created, but got this exception:

System.ArgumentException: WSE813: The following transport address could
not be mapped to a local network interface: soap.tcp://<new ip
address>:<port>/MyService.

Any ideas on how to solve this issue? Restarting the Windows Service
does work, but is not an option.

Thanks,
Wouter
Wouter Demuynck - 25 May 2005 15:36 GMT
With some help from .NET reflector, I found that when using the
hostname in the Uri instead of an IP address will result in
SoapTcpTransport.GetLocalIPEndPoint returning IPAddress.Any, which is
what I want. After executing the following code, the web service will
be available on all local IP addresses.

IPHostEntry hostentry = Dns.GetHostByName(Dns.GetHostName());
Uri address = new Uri("urn:MyService");
Uri via = new Uri(String.Format("soap.tcp://{0}:<port>",
hostEntry.HostName));
EndpointReference epr = new EndpointReference(address, via);
SoapReceivers.Add(epr, webService);

It looks like the local IP addresses are read once when the
SoapTcpTransport instance is constructed, and never refreshed
afterwards. Hence the "could not be mapped error".

Wouter

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.