我有针对spun-up IIS Express服务器运行的集成测试。在我的其他团队成员的机器上,这些测试运行良好。但是,在我的计算机上,IIS Express在测试运行的中途崩溃,导致之后的所有测试都失败。
我很快就没有重新格式化我的硬盘驱动器并擦掉地球上的所有东西了 - 这看起来很极端,但如果这是我唯一的选择,那就这样吧。
更新
以下是事件查看器中显示的错误:
ASP.NET 4.0.30319.0,11:36:44 AM
An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/1/ROOT
Process ID: 6072
Exception: System.Threading.ThreadAbortException
Message: Thread was being aborted.
StackTrace: at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
应用程序错误,上午11:36:44
Faulting application name: iisexpress.exe, version: 8.5.9748.0, time stamp: 0x5384d451
Faulting module name: KERNELBASE.dll, version: 6.3.9600.17278, time stamp: 0x53eeb460
Exception code: 0xe0434352
Fault offset: 0x00012f71
Faulting process id: 0x17b8
Faulting application start time: 0x01d0d90283199962
Faulting application path: C:\Program Files (x86)\IIS Express\iisexpress.exe
Faulting module path: C:\WINDOWS\SYSTEM32\KERNELBASE.dll
Report Id: c3187027-44f5-11e5-82a2-a0481c829032
Faulting package full name:
Faulting package-relative application ID:
ASP.NET 4.0.30319.0,11:36:48 AM
An unhandled exception occurred and the process was terminated.
Application ID: DefaultDomain
Process ID: 6072
Exception: System.Threading.ThreadAbortException
Message: Thread was being aborted.
StackTrace:
.NET Runtime,上午11:36:48
Application: iisexpress.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Threading.ThreadAbortException
Stack:
应用程序错误,上午11:36:48
Faulting application name: iisexpress.exe, version: 8.5.9748.0, time stamp: 0x5384d451
Faulting module name: KERNELBASE.dll, version: 6.3.9600.17278, time stamp: 0x53eeb460
Exception code: 0xe0434352
Fault offset: 0x00012f71
Faulting process id: 0x17b8
Faulting application start time: 0x01d0d90283199962
Faulting application path: C:\Program Files (x86)\IIS Express\iisexpress.exe
Faulting module path: C:\WINDOWS\SYSTEM32\KERNELBASE.dll
Report Id: c5aab60e-44f5-11e5-82a2-a0481c829032
Faulting package full name:
Faulting package-relative application ID:
更新2
当捕获第一次机会异常并附加到IIS Express进程时,我得到以下异常:
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
Additional information: Thread was being aborted.
尝试呼叫context.Response.Redirect("~/ErrorPages/AccessDenied.aspx", true);
时会发生这种情况。重定向到此页面的其他网页可以成功完成此操作。
更新3
以下是关闭" Just My Code"
时的第一次机会例外第一
System.Globalization.CultureNotFoundException occurred
Message: A first chance exception of type 'System.Globalization.CultureNotFoundException' occurred in mscorlib.dll
Additional information: Culture is not supported.
第二
System.Web.HttpException occurred
_HResult=-2147024809
_message=Invalid file name for file monitoring: 'D:\Dev\Git\Qualtrax\Web\Content'. Common reasons for failure include:
- The filename is not a valid Win32 file name.
- The filename is not an absolute path.
- The filename contains wildcard characters.
- The file specified is a directory.
- Access denied.
HResult=-2147024809
IsTransient=false
Message=Invalid file name for file monitoring: 'D:\Dev\Git\Qualtrax\Web\Content'. Common reasons for failure include:
- The filename is not a valid Win32 file name.
- The filename is not an absolute path.
- The filename contains wildcard characters.
- The file specified is a directory.
- Access denied.
Source=System.Web
ErrorCode=-2147024809
WebEventCode=0
StackTrace:
at System.Web.DirectoryMonitor.AddFileMonitor(String file)
InnerException:
第三
System.Net.Sockets.SocketException occurred
_HResult=-2147467259
_message=A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
HResult=-2147467259
IsTransient=false
Message=A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Source=System
ErrorCode=10060
NativeErrorCode=10060
StackTrace:
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
InnerException:
四
System.IO.IOException occurred
_HResult=-2146232800
_message=Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
HResult=-2146232800
IsTransient=false
Message=Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Source=System
StackTrace:
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
InnerException: System.Net.Sockets.SocketException
_HResult=-2147467259
_message=A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
HResult=-2147467259
IsTransient=false
Message=A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Source=System
ErrorCode=10060
NativeErrorCode=10060
StackTrace:
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
InnerException:
第五(这一次发生在坠机前):
System.Threading.ThreadAbortException occurred
_HResult=-2146233040
_message=Thread was being aborted.
希望其中一些帮助。
答案 0 :(得分:1)
事实证明,这个问题的答案解决了我的问题:https://stackoverflow.com/a/24880514/2689694
简而言之,因为我安装了Visual Studio 2015,我的IIS配置已被修改为使用不同的管道模式。我们的代码中的那些重定向倾向于传递true
作为重载,这意味着响应将结束 - 这会抛出一个线程中止的异常。修复是(如链接所讨论的)使用Context.ApplicationInstance.CompleteRequest()
而不是重载布尔值。这意味着它现在可以正常独立于管道模式。