Why it's so slow when a wcf client connects to the service?

后端 未结 3 2031
北恋
北恋 2021-01-06 07:50

I met a performance issue when using the WCF service.

Here\'s the story:

  1. I wrote a self-hosted WCF service which is hosted by a console application

相关标签:
3条回答
  • 2021-01-06 08:22

    We experiences the same, I figured out that it is the client that sleeps up to 14 seconds before actually opening the TCP connection.

    A simple call to

    binding.UseDefaultWebProxy = false;
    

    solved this.

    0 讨论(0)
  • 2021-01-06 08:30

    One way could be to add your own warmup script; a script that calls your service on initial load.

    Though, this answer might help you, usually, the first access to the service is slow, but the consecutive accesses would be within a sec or two.

    The first slow response is related to the JIT compilation of the service assemblies; which means its normal.

    Alternatively, you may want to Profile you app. Also you may would like to checkout this article that I wrote some time back.

    0 讨论(0)
  • 2021-01-06 08:35

    This should help: http://msdn.microsoft.com/en-us/library/aa751883.aspx

    If you host on IIS, that takes a while to start up no matter what.

    0 讨论(0)
提交回复
热议问题