I have two sites running on my development machine for the last 8 months or so. Both sites use ASP.NET Core, and both are running on Kestrel behind IIS.
During the last couple of weeks, the sites have become a headache. After building or restarting IIS, the sites work fine, but a few minutes later, they get unresponsive. Nothing, and I mean absolute nothing happens when I access them in a browser, or from any another application. No output is shown in VS (if the debugger is attached it fails anyway). If I enable stdout in web.config, I can see that it takes serveral seconds, just to log the query of a statement from Entity Framework. The problem persists if I disable stdout.
My machine is an i7-6700K with 16 gb ram. When this is happening my CPU usage is around around 0-3%, and the last time I checked I had 50% free of memory.
Both sites are using MySQL server 5.7 which is also used by other applications at the same time. Regular ASP.NET websites work fine when this is happening.
NuGet packages used in both projects:
- IdentityServer4 2.0.4
- IdentityServer4.EntityFramework 2.1.0
- MailKit 2.03
- Microsoft.AspNetCore.All 2.0.7
- Microsoft.VisualStudio.Web.CodeGeneration.Design 2.0.0
- MySql.Data 8.0.11
- NLog 4.5.3
- NLog.Web.AspNetCore 4.5.2
- Pomelo.EntityFrameworkCore.MySql 2.0.1
Furthermore, Project A is referencing:
- IdentityServer4.AspNetIdentity 2.1.0
- Microsoft.EntityFrameworkCore.Tools 2.0.2
- NETStandard.Library 2.0.2
- Ngonzalez.ImageProcessorCore 0.0.1
Project B is referencing:
- Hangfire 1.6.17
- Hangfire.MySql.NetCore 1.0.7
- IdentityServer4.AccessTokenValidation 2.1.0
- Microsoft.AspNetCore.Mvc.Versioning 2.0.0
Software versions:
- Visual Studio Enterprise 2017 version 15.6.7
- dotnet --version: 2.1.105
- Windows 10 Pro 1709 16299.371
Both sites are working fine in our production Web server, the issue is only happening in my development machine, and with the exact same builds!
Update 2018-05-08
I have tried setting nLog dbProvider and removed MySql.Data NuGet package as suggested by Mark G. but the problem is still there.
Have formatted and installed the whole PC. No change.
Update 2018-05-09
Debugging seems keeping the sites alive.. but thats not a viable solution.
Update 2018-05-09
Now it also happens in production.
Update 2018-05-09
I have tried an earlier version of the sites, where NLog wasn't implemented yet, and therefore no MySql.Data, and Microsoft.AspNetCore.All isn't forced to 2.0.7, just 2.0.0, and I have the same results.
I have also tried updating all NuGet packages to the newest versions without luck.
Update 2018-05-11
I might be getting close to find a solution. I have removed the following two lines of code from my Startup.Configure() which always have been there. It looks promising, but I havent had too much time to test, but as far as I can tell it have solved the problem for now! :)
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();