【问题标题】:IIS Express Worker has stopped working when running testsIIS Express Worker 在运行测试时已停止工作
【发布时间】:2015-11-10 05:08:37
【问题描述】:

我有针对启动的 IIS Express 服务器运行的集成测试。在我其他团队成员的机器上,这些测试运行良好。但是,在我的机器上,IIS Express 在测试运行中途崩溃,导致之后的所有测试都失败。

  1. 我正在运行我知道在其他人的机器上通过的测试,包括我们的构建服务器
  2. 不使用 IIS Express 不是一种选择,因为那样我的构建环境将与团队的不一致。此外,这些测试在一周前运行良好,所以这应该不是问题。
  3. 我已卸载并重新安装了 Visual Studio 2013.5,但无济于事。
  4. 我已卸载 IIS 10 Express 并安装了 IIS 8.0 Express,但无济于事。 (我找不到任何 IIS 10 Express 的下载/安装程序,但这绝对是之前在机器上安装的。)
  5. 我已完全卸载 Visual Studio 2015,以防它与 2013 安装发生冲突。也无济于事。
  6. 我们所有的机器都是相同的版本,所以我知道这不是硬件问题。
  7. 我的机器运行的是 Windows 8.1 x64。该项目是一个运行 .NET 4.5.1 的混合 ASPX/MVC Web 项目

除了重新格式化我的硬盘驱动器并从地球上清除所有东西之外,我很快就会用尽想法 - 这似乎很极端,但如果这是我唯一的选择,那就这样吧。

更新

以下是事件查看器中显示的错误:

ASP.NET 4.0.30319.0,上午 11:36:44

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

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 运行时,上午 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

以下是关闭“仅我的代码”时的第一次例外情况

第一

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.

希望其中一些帮助。

【问题讨论】:

  • 系统或应用程序事件日志中有任何消息吗?通常 IIS Express 中的崩溃会记录到事件日志中以供您阅读。
  • 我已经用相关事件日志更新了问题
  • 见:stackoverflow.com/a/14897073/736079。似乎有一个未处理的异常导致 IIS 停止。
  • 您是否尝试过附加调试器并让它在未处理的异常时中断?
  • 我有。我们的网络应用程序没有抛出任何错误。据我所知,IIS Express 内部正在发生一些事情。同样,这些测试在所有其他运行 IIS Express 的机器上完全通过,这一事实进一步加剧了这种情况。

标签: asp.net iis visual-studio-2013 integration-testing


【解决方案1】:

事实证明,这个另一个问题的答案解决了我的问题:https://stackoverflow.com/a/24880514/2689694

简而言之,因为我安装了 Visual Studio 2015,我的 IIS 配置已被修改为使用不同的管道模式。我们代码中的那些重定向倾向于将true 作为重载传递,这意味着响应将结束——这会引发线程中止异常。解决方法是(如链接所讨论的)使用 Context.ApplicationInstance.CompleteRequest() 而不是重载布尔值。这意味着它现在可以独立于管道模式正常运行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-14
    • 2020-09-12
    • 2018-06-15
    相关资源
    最近更新 更多