I just transitioned some of my website's code from using QueueUserWorkItem to Task.Factory.StartNew
I have some bad code that threw an Exception and it ultimately shut down w3wp. Running IIS 7.5 on Windows Server 2008 R2, x64
Task.Factory.StartNew(() =>
{
MethodThatThrowsException();
}
Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AggregateException
Stack:
at System.Threading.Tasks.TaskExceptionHolder.Finalize()
Exception: System.AggregateException
Message: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.
StackTrace: at System.Threading.Tasks.TaskExceptionHolder.Finalize()
InnerException: System.Data.SqlClient.SqlException
I would have assumed an exception would have generated an event log and NOT have killed w3wp. Is this a wrong assumption?
Unhandled exceptions crash IIS worker process. This is by design. http://support.microsoft.com/kb/911816
Therefore, you should properly handle exceptions.
Related
I'm going to use SignalR in a windows service as client.
Service is running under administrator privileges.
And "Microsoft.AspNet.SignalR.Client" package added by nuget.
running code as windows application has no errors and runs correctly. but when I install it as service, service stops and in windows Events I can see this error.
this answer did not resolved my problem.
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
Exception Info: System.IO.FileNotFoundException
at Microsoft.AspNet.SignalR.Client.Http.DefaultHttpClient.Initialize(Microsoft.AspNet.SignalR.Client.IConnection)
at Microsoft.AspNet.SignalR.Client.Transports.TransportHelper.GetNegotiationResponse(Microsoft.AspNet.SignalR.Client.Http.IHttpClient, Microsoft.AspNet.SignalR.Client.IConnection, System.String)
at Microsoft.AspNet.SignalR.Client.Transports.AutoTransport.GetNegotiateResponse(Microsoft.AspNet.SignalR.Client.IConnection, System.String)
at Microsoft.AspNet.SignalR.Client.Transports.AutoTransport.Negotiate(Microsoft.AspNet.SignalR.Client.IConnection, System.String)
at Microsoft.AspNet.SignalR.Client.Connection.Negotiate(Microsoft.AspNet.SignalR.Client.Transports.IClientTransport)
at Microsoft.AspNet.SignalR.Client.Connection.Start(Microsoft.AspNet.SignalR.Client.Transports.IClientTransport)
at Microsoft.AspNet.SignalR.Client.Connection.Start()
I don't know why, but when I catch error, the error text changes and says System.Net.Http is missing.
And I don't know why it runs perfectly as widows application, but not in service.
my .net service application started crash occasionally. Once investigate in windows event viewer, I get the below message:
Application: myapp.exe Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.IOException at
System.IO.__Error.WinIOError(Int32, System.String) at
System.IO.__Error.WinIOError() at
System.Threading.EventWaitHandle.Set() at
System.IO.FileStreamAsyncResult.AsyncFSCallback(UInt32, UInt32,
System.Threading.NativeOverlapped*) at
System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32,
UInt32, System.Threading.NativeOverlapped*)
From the error message, I'm not sure which part of my source code is giving me this error. Do you guys know what error is this?
And is it that because I didn't put a try/catch block on some of my code that's why it will have this error and crashes my app?
This exception will be thrown when an I/O errors occurs. When process can't read or write correctly. Maybe Its because of your threading,It can't be done correctly.
"And is it that because I didn't put a try/catch block on some of my code that's why it will have this error and crashes my app?" ->
And yes,you see the error because you didn't use any try/catch block.
Can anyone explain how System.Windows.Forms.Application.ProductVersion can throw a FileNotFoundException?
Stack trace is
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
Stack:
at System.Diagnostics.FileVersionInfo.GetVersionInfo(System.String)
at System.Windows.Forms.Application.GetAppFileVersionInfo()
at System.Windows.Forms.Application.get_ProductVersion()
The error only affects one user and is inconsistent, but when it occurs, it is when the application is starting up, so the exe must exist for the application to start.
The exe resides on a network share, but there is no evidence of any network or disk errors.
What is also strange is that the program sets up UnHandledException and ThreadException handlers to log all such errors and these routines are not being called.
Any ideas?
There is probably a latency observed in accessing the network share location. You can first check if the file exists at that location and then get the version, to avoid this.
I have an application hosted in iis. Very occasionally (every month or two) the following exception is thrown:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for "System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory" threw an exception. ---> System.MissingFieldException: Field not found: ?.s_webServicesFactoryType.
The application is set to automatically recycle every day and it seems sometimes after a recycle this exception is thrown repeatedly until the next recycle.
The only hit I can find on google is http://mcfunley.com/135/bizarro-typeinitializationexception-in-systemruntimeremoting, which describes the exact same problem but there doesn't seem to be a solution posted.
Has anyone experienced this before?
Thanks in advance.
We have over 1000 unit tests. A while ago 18 of them started to fail when they were run together with the other tests. These tests run a windows workflow.
If they are run alone they pass.
The error appears to be that it cannot find the connection string.
It cannot find the connection string because it does not know which config file to look in.
It does not know which config file to look in because it cannot find the application context
And it cannot find the application context due to a compilation lock.
Anybody have any idea what could be wrong, and how to fix this? The error I am getting is:
Message: Exception message: The
supplied connection string is not
valid, because it contains
insufficient mapping or metadata
information. Parameter name:
connectionString Inner exception :
System.InvalidOperationException:
Unable to determine application
context. The ASP.NET application path
could not be resolved. --->
System.Reflection.TargetInvocationException:
Exception has been thrown by the
target of an invocation. --->
System.Web.HttpException: The type
initializer for
'System.Web.Compilation.CompilationLock'
threw an exception. --->
System.TypeInitializationException:
The type initializer for
'System.Web.Compilation.CompilationLock'
threw an exception. --->
System.NullReferenceException: Object
reference not set to an instance of an
object. at
System.Web.Compilation.CompilationLock..cctor()
--- End of inner exception stack trace --- at System.Web.Compilation.CompilationLock.GetLock(Boolean&
gotLock) at
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
Thanks
Shiraz
Since you mention that your tests run a WF workflow, I would guess that a previous test run has one or more workflow instances that still run on a thread somewhere, thus locking the compiler because the assemblies are still loaded in a process somewhere.
Can you open Task Manager and investigate whether there's a running process that still uses the workflow somewhere? If so, kill it and see if you can't compile.