1

We have a C# mvc project that runs fine on several computers. On one PC I have a strange issue and at first I thought it was coding related, hence a question on stackoverflow. But after some tests, it doesn't seem to be coding related.

The project runs on a local IIS on windows 10 and has several controllers (pages). When I browse to the homepage (and several other pages) on the same computer, it takes about 2minutes to receive the first byte, every time. Other pages of the project run fast.

Naturally I thought it was because of the code on those pages, but debugging showed all the pages (fast an slow) hit the last event (Application_PreSendRequestContent) within 100ms. After that it should start sending data.

If i access this website from another computer via network, it works as it should. Even when the same computer is still waiting for the first byte of the homepage, the other computer can request the same page directly.

Overview:

  • PC 1: windows 10 / IIS
  • PC 1: Request homepage on PC1: 2minutes to first byte
  • PC 1: Request page X1 on PC1: 2minutes to first byte
  • PC 1: Request page X2 on PC1: instant result
  • PC 1: Request page X3 on PC1: instant result

  • PC 1: Request homepage and waits for first byte

  • PC 2: Request homepage on PC1: instant result
  • PC 3: Request homepage on PC1: instant result
  • PC 1: Finally receive the homepage after 2minutes.

What i ruled out:

  • Coding issue: would be slow everywhere
  • IIS issue: would be slow everywhere
  • Browser issue: happens in Firefox, Chrome and Edge
  • Parsing issue: content-type is text/plain
  • DNS issue: Access via IP address has same problem

I have no idea what else I can look for.

  • What does the network setup look like? Are you using any kind of authentication that might take time? What addresses are you using to access the site locally? From your description it would appear it's rather infrequent that the problem exists locally as there are times when it doesn't happen. Is there any kind of special load on the machine? What other processes does it run? Is that site the only site hosted on it? – Seth Apr 24 '17 at 12:08
  • It happens all the time on some pages (always the same) and it never happens on some other pages (also always the same). But everything is processed before Application_PreSendRequestContent (Authentication, database, sessions, etc) and it hits that point after 100ms. See ASP.NET Application Life Cycle. Its a development machine not doing much else. Local access with 127.0.0.1 or 192.168.190.40 is slow, access 192.168.190.40 from another PC is fast. – Hugo Delsing Apr 24 '17 at 12:23
  • Do those pages change between sessions or are they really always the same? What about the memory consumption on the machine? Did you check that the Application Pool isn't getting recycled if you call those pages? If the pages don't change, is the call also fast if you first request them from a remote location instead of the local machine (i.e. you request X1 from PC2 before requesting it from PC1)? – Seth Apr 24 '17 at 12:30
  • Its not a recycle issue. Every time I call locally it has a 2min timeout and everytime I call remotely it loads instant. On first load the remote site is slower for startup obviously, but after that its fast. No matter if i call the page 10 or 100 times. If I call the page locally after 50 remote calls, local is still slow and remote is still fast – Hugo Delsing Apr 24 '17 at 13:21
  • 1
    It turns out it was the Sophos anti-virus software. I disabled it and it was fast for all pages, Found it as an answer on your link. Thanks @Seth – Hugo Delsing Apr 26 '17 at 7:34

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.