WCF: System.Net.SocketException - Only one usage of each socket address (protocol/network address/port) is normally permitted

后端 未结 2 597
有刺的猬
有刺的猬 2020-12-01 00:32

I have a WCF service and a Web application. Web application makes calls to this WCF service in a continous manner a.k.a polling. In our production environment, I receive thi

2条回答
  •  春和景丽
    2020-12-01 01:18

    HttpClient, although it implements IDisposable is a shared object, you should reduce the number of instances as much as possible. You can get away with only having one instance for the entire lifetime of your application rather than one for each request.

    I wrote about it pretty extensively at http://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/

提交回复
热议问题