views:

206

answers:

1

Hello All,

I need some help in resolving an issue I'm facing an with communication of a desktop client with WCF service hosted on IIS.

What I'm trying to do in my test case:

  1. Server hosts a WSDualHttpBinding service
  2. Client establishes a connection (calls Register method) to this by providing its callback uri which contains the client’s IP Address
  3. Once connection is established, a web page is launched by the client application. User types some text into the textbox and clicks Send. The web page sends the text to all registered desktop clients.

Issue:

In step 2, a PC may have multiple IP Addresses (Ethernet adapter, loopback adapters etc). If during the registration call, an IP from this list is sent in the callback url which cannot be called back from the server (e.g. loopback adapter IP), a timeout exception is thrown. After a few such attempts, the server cannot accept calls from clients anymore (whether valid IP or otherwise). Sometimes “server too-busy” exception was thrown.

(I cannot use machine’s fully qualified name in the callback uri due to DNS/WINS configuration issues causing the server to not not resolve machine name to the correct IP address).

How to reproduce:
a. Publish the server on IIS. From a different machine with multiple IP addresses, execute the client. The client throws timeout exceptions and program exits after 3 tries b. A parameter in the App.Config allows one to type in the right IP address (IP to use). Now if the program is launched, everything works fine.
c. If I remove this IP address specified above so that an incorrect IP is used, again step a happens. Run the programs 2-3 times in this mode.
d. Make changes as in step b and run the program. Sometimes I get a timeout exception. Other times, the web site comes up. However when text is entered and sent, it doesn't come to the client. (The register method worked even though web service did not receive any call. Sending function fails as there are no registered clients on the web service.

I’m not sure why exactly this happens and how to address it. Here is my Visual studio solution - http://bit.ly/atKfOS

Highly appreciate any inputs, comments. Environment: Server - Windows XP (IIS 5), Windows Server 2008 SP2 x64 (IIS 7), Client: Windows XP

Thanks GC

A: 

Well, I guess the main problem is this: when the server tries to call back to the client and fails, the channel between the two will become "faulted", and rendered useless.

After such an event happens, you have to dispose the client side proxy, and recreate it - or gracefully handle the timeout exception on the server (catch it, turn it into a SOAP fault, log it - whatever - just don't let the unfiltered .NET TimeoutException pass back to the client, this will fault the channel).

What do you do on your server side when such a TimeoutException happens? Do you make sure not to bubble up that exception all the way up to the channel??

marc_s
Thanks marc_s. I'll apply your suggestion and report.On the server side, when any exception occurs while sending a message, a Faulted event is thrown. The service handles this by removing this client from the registered list of clients and sets the client to null.
GC
You are right Marc. I disposed the client side proxy and its working as expected now. I wrongly assumed that it would be closed when the program terminated.Thanks!!
GC