NullReferenceException in IISHttpContext
See original GitHub issueDescribe the bug
Since updating a website running in Azure App Service to use ASP.NET Core 2.2.0 with in-process hosting, I’ve observed a small number of NullReferenceException
s being thrown via Application Insights.
System.NullReferenceException:
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.GetOriginalPath (Microsoft.AspNetCore.Server.IIS, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.InitializeContext (Microsoft.AspNetCore.Server.IIS, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1+<ProcessRequestAsync>d__2.MoveNext (Microsoft.AspNetCore.Server.IIS, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer+<HandleRequest>d__27.MoveNext (Microsoft.AspNetCore.Server.IIS, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
To Reproduce
Application experiencing the issue was built from this commit: martincostello/website@ee2ca4ba02823b97062924b7dc8f313e6278a3f8
Expected behavior
HTTP request is processed successfully.
Screenshots
Additional context
Add any other context about the problem here.
Include the output of dotnet --info
Issue Analytics
- State:
- Created 5 years ago
- Reactions:14
- Comments:38 (21 by maintainers)
Top Results From Across the Web
IISHttpServer OnDisconnect NullReferenceException
NET Core web application that is primarily based on executing Endpoints, I frequently get a NullReferenceException on the AbortIO call following ...
Read more >dotnet core 5 hosted in IIS using inprocess (Serilog ???)
Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.AspNetCore.Hosting.
Read more >AspNetCore.Server.IIS.Core.IISHttpServer - Connection ID ...
An unhandled exception was thrown by the application. System. ... NET core has own App Pools. ... IISHttpContext.OnStarting(Func 2 callback, ...
Read more >ASP.Net Core – Unexpected exception in IISHttpServer. ...
asp.net-corec++iis. I have ASP. ... NullReferenceException: Object reference not set to an instance of an object.\r\n at ... HandleRequest(IISHttpContext
Read more >Issues with System.NullReferenceException occurrence ...
NET Core 3.1 is breaking when starting the web application because of a NullReferenceException, but this one is thrown in the IISHttpServer.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If I understand this thread correctly, we are supposed to wait for another release and in the meantime this is not causing any harm. But it is really distracting to see these false positives where we expect to see only “real” exceptions. Is there some middleware that you can provide to catch this condition? I do not want to filter this on my side, for fear of eating up an authentic failure. TIA
I’m glad this will be addressed in 3.0 but will this be addressed in 2.2.x or 2.x?