I'm facing a problem with IIS + Kestrel hosting of asp.net core application (web api).
Sometimes response delay is about 5sec. In such case Chrome shows "GET net::ERR_CONNECTION_TIMED_OUT" (but Firefox waits until response)
It only happens on IIS, if I run it locally within Visual Studio Code it works fine (at least I haven't caught any "freezes").
There is some info from app log on server side. For successful request it looks like:
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 OPTIONS http://
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 0.2813ms 204
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://
info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerMiddleware[2]
Successfully validated the token.
info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerMiddleware[3]
HttpContext.User merged via AutomaticAuthentication from authenticationScheme: Bearer.
info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1]
Authorization was successful for user: admin.
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
Executing action method <method-name> with arguments <args> - ModelState is Valid
info: Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor[1]
Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext.
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
Executed action <method-name> in 41.9809ms
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 42.6694ms 200 application/json; charset=utf-8
for failed looks like:
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 OPTIONS http://
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 0.3408ms 204
Application pool for that app is set up without managed code.
Web.config contains:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\app.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="app-release" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration>
What may be a cause of such strange behaviour?
P.S.
- IIS version - 10
- netcoreapp - 1.1 (common "Microsoft.AspNetCore." libraries - 1.1.1)
Update:
I set "Trace" level for logging and didn't see any logs about "corrupted" request, only about requests before. Also took a look at chrome dev's tools "network" tab and there is:
Request Headers
Provisional headers are shown
Access-Control-Request-Headers:access-control-allow-origin,authorization
Access-Control-Request-Method:GET
Update:
I have no idea why but it's started to spontaneously error even on static content like css.
Also I forget to note that I have the same functionality on asp.net web api 2 (not core) - and it works fine on the same server. Founded such info in log before slow request:
dbug: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HL3SC4O1J78T" stopped.
dbug: Microsoft.AspNetCore.Server.Kestrel[8]
Connection id "0HL3SC4O1J78S" sent FIN with status "0".
dbug: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HL3SC4O1J78S" stopped.
dbug: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HL3SC4O1J78R" stopped.
dbug: Microsoft.AspNetCore.Server.Kestrel[8]
Connection id "0HL3SC4O1J78V" sent FIN with status "0".
dbug: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HL3SC4O1J78V" stopped.
Update:
There is no any messages in IIS log (within inetpub/logs
) about "corrupted" request too. Just an information about last successful request-response. It looks like request isn't handled by IIS at all. Is it possible (I'm not experienced in IIS setup and configuraiton)?
Also tried to use a stub - empty .net core application instead of my. The result is the same. From what I'm concluding that the problem isn't in my app