ASMX Web Service slow first request

后端 未结 7 1815
迷失自我
迷失自我 2020-11-27 16:33

I have a bunch of .NET Webservices running in one IIS Application. These webservices are consumed by another IIS Application (frontend). The first call is pretty slow, about

7条回答
  •  -上瘾入骨i
    2020-11-27 17:11

    Sorry for the necro add, but this has been an ongoing struggle for me as well, and I wanted to add some info to the picture. VisualStudio itself adds a rather large component to the time. Here's the basic test, involving a bare-bones forms app and an already-running webservice hosted internally on a company server (with Generate Serialization Assembly set to true for all tests):

    Running in VS, Debug:
        First Call: 400 ms to set up client object, 450 to call function
        Second Call: 1 ms to set up client object, 14 to call function
    Running as .exe, Release:
        First Call: 20 ms to set up client object, 70 to call function
        Second call: 1 ms to set up client object, 4 to call function
    Running the Debug's .exe file outside of vs:
        First Call: 20 ms to set up client object, 80 to call function
        Second call: 1 ms to set up client object, 4 to call function
    Running as Release within VS:
        Similar results to Debug in VS -- very slow
    

    Short story? Visual Studio is adding a large chunk of time to the picture. Instead of ~90 ms, it's taking nearly a second. So if you're doing performance tuning, make sure you do your testing outside the VisualStudio environment.

提交回复
热议问题