Closing WCF Proxy

I've always followed the try / Close / catch / Abort instructions when it comes to WCF proxy. I now come across a code base that creates proxies in MVC controllers and just lets them go out of scope. I submit that we need to edit the code base to use try / Close / catch / Abort, but there is resistance.

Does anyone know of a metric (like perfmon) that I can capture to illustrate the problem / benefit. Or a definitive link that describes a problem / benefit that no one can dispute?

+2


source to share


2 answers


You can create a sample application to simulate the problem. Although I haven't tried, you can try this,

  • Create a simple service and limit maxConcurrentCalls

    and maxConcurrentSessions

    to 5.

  • Create a client application and in that call the service method without closing the connection.

  • Run 6 or more clients

  • See what happens when you open a new client connection. The client will probably wait a certain amount of time and you will get some kind of exception.



If the client doesn't close the connection properly, the connection will still remain open in the service, so what happens if 1000 clients connect to the service at a time and leave their connections open? The service has a limitation that it can connect to servers at the same time, and because of this, the service cannot process new requests from clients and that closing connections is very important.

I think you are aware of the issue using

in the WCF service. In my applications, I close WCF connections using an extension method as said in this.

+1


source


Have you tried the simple "netstat -N" from the command line on both the server and client? Yoy will most likely see a lot of pending / pending connections, which can run out of server resources for no reason.



0


source







All Articles