microsoft / referencesource

Source from the Microsoft .NET Reference Source that represent a subset of the .NET Framework
https://referencesource.microsoft.com/
MIT License
3.16k stars 1.27k forks source link

.net 4.5.2 - w3p crash with .net web api #43

Closed sannaroby closed 5 years ago

sannaroby commented 6 years ago

We've a problem with our .net web API 2 web services hosted on IIS-7 (windows server 2008 R2. net 4.5.2). Sometimes the w3p process crashes. We can see this from the server event viewer.

An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/57/ROOT

Process ID: 7340

Exception: System.ArgumentException

Message: Value does not fall within the expected range.

StackTrace:    at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at System.Web.Hosting.IIS7WorkerRequest.GetUserToken()
at System.Web.HttpContext.get_ClientIdentityToken()
at System.Web.HttpContext.get_ImpersonationToken()
at System.Web.ClientImpersonationContext.Start(HttpContext context, Boolean throwOnError)
at System.Web.ThreadContext.EnterExecutionContext()
at System.Web.Hosting.AspNetHostExecutionContextManager.SetHostExecutionContext(HostExecutionContext hostExecutionContext)
at System.Threading.HostExecutionContextManager.SetHostExecutionContextInternal(HostExecutionContext hostContext)
at System.Threading.ExecutionContext.SetExecutionContext(ExecutionContext executionContext, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

We have logs for each method that could be called by clients, at the start and at the end of each methods. When the w3p crashes there is no log for our methods. It seems that the request fail before to arrive to the method or after to have processed the request.

sannaroby commented 6 years ago

I've added here a DebugDiag Analysis Report and the app pool settings here.

terrajobst commented 5 years ago

This repo only tracks infrastructure issues regarding the following items:

For issues regarding functionality, please use the following resources: