IIS 7 and Above
w3p crash with .net web api
Last post Dec 04, 2017 07:44 AM by Yuk Ding
Nov 30, 2017 09:07 PM|bob791|LINK
We've a problem with our .net web API 2 web services hosted on IIS-7.5 (windows server 2008 R2. net 4.5.2). Sometimes the w3p process crashes. We can see this from the server
An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/57/ROOT
Process ID: 7340
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.ClientImpersonationContext.Start(HttpContext context, Boolean throwOnError)
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)
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.
here a DebugDiag Analysis Report and the app pool settings
Dec 01, 2017 05:33 AM|Yuk Ding|LINK
The debug diagnostic tool just display an error inside the worker process. The asp.net run under the IIS pipeline, so it is not w3wp.exe crash the application but there is something wrong inside your application. Just ensure your web API service could works
fine in development environment. The report just show an application error.
Dec 01, 2017 08:20 AM|bob791|LINK
Hi Yuk, thanks for your reply.
in the report sections "Previous .NET Exceptions Report" and "Previous .NET Exceptions Report (Exceptions in all .NET Heaps)", we can't see any exceptions from our code (as you can see in the "Stack trace" column of those sections). Furthermore,
we've a "GlobalExceptionHandler" that catch all unmanaged exception.
We've written here, because we don't know what is going wrong and in the server event viewer we see "System.Web.Hosting.IIS7WorkerRequest.GetUserToken()" as last instruction, before exception is raised. We don't use impersonation or similar...
Dec 04, 2017 07:44 AM|Yuk Ding|LINK
Maybe you could post the dump file to asp.net forum or consult the expert. I think the dump need a deep analyze, then it should find the error code. I'm sorry that I think I'm not a good dump analyzer for the .net web api.