IIS7 间歇性地抛出 500 错误。 谁能帮我诊断一下吗?

发布于 2024-07-30 06:41:43 字数 2171 浏览 5 评论 0原文

抱歉标题含糊不清,因为我真的无法简洁地解释这个问题。

基本上我有 Windows Server 2008 x64、IIS7、ASP.NET 2.05,并且我有一个在 Classic AppPool 中运行的站点(并且我无法在 Integrated 中运行)。

当第一次尝试加载 *.aspx 文件时(即安装站点、重新启动服务器等之后),我收到此错误:

HTTP 错误 500.0 - 内部服务器错误
由于发生内部服务器错误,该页面无法显示。
模块:IsapiModule
通知:执行请求处理程序
处理程序:PageHandlerFactory-ISAPI-2.0-64
错误代码:0x800710dd
登录方式:匿名
登录用户:匿名

处理程序是默认的IIS7处理程序:

<add name="PageHandlerFactory-ISAPI-2.0-64" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" />


我什至尝试添加自己的aspx处理程序,如下所示:

<add name="aspx" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness64" />

唯一要做的就是将错误通知的处理程序部分更改为IsapiModule 。

奇怪的是,这个错误只在第一次发生(或者当服务器空闲了几个小时时)。 当我看到这个错误时,如果我刷新页面,一切都会恢复正常。

我什至尝试删除 web.config 文件,但毫无效果。

我似乎无法在互联网上找到这个问题的单一答案。

编辑:我启用了失败请求跟踪,它显示的是:

MODULE_SET_RESPONSE_ERROR_STATUS 警告 ModuleName="IsapiModule"、Notification="EXECUTE_REQUEST_HANDLER"、HttpStatus="500"、HttpReason="内部服务器错误"、HttpSubStatus="0"、ErrorCode="操作标识符无效。 (0x800710dd)", ConfigExceptionInfo=""

就在它显示的错误之前:

NOTIFY_MODULE_START ModuleName="IsapiModule"、Notification="EXECUTE_REQUEST_HANDLER"、fIsPostNotification="false"、fIsCompletion="false"

现在,当我将此与成功运行进行比较时,区别在于错误会产生 MODULE_SET_REPONSE_ERROR_STATUS 而成功运行则不会(并且然后继续生成正确的 HTML 输出)。

编辑:我使用了一个简单的应用程序并尝试运行它,但收到了相同的错误。 但是当应用程序池处于集成模式时,它运行良好! 不幸的是,由于我无法指定的原因,我无法将我们的应用程序迁移到集成,但我将其范围缩小到应用程序池。 另外,我不必重新启动服务器来重现错误,而是回收应用程序池即可。

摘要:
- 如下所述,事件日志中没有任何内容表明失败。 我梳理了事件查看器中的所有日志

Sorry for the vague title, as I really can't explain this problem succinctly.

Basically I have Windows Server 2008 x64, IIS7, ASP.NET 2.05, and I have a site running in a Classic AppPool (and no I cannot run in Integrated).

When trying to load an *.aspx file for the first time (i.e. after installing site, restarting the server, etc) I get this error:

HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.
Module: IsapiModule
Notification: ExecuteRequestHandler
Handler: PageHandlerFactory-ISAPI-2.0-64
Error Code: 0x800710dd
Logon Method: Anonymous
Logon User: Anonymous

The handler is the default IIS7 one:

<add name="PageHandlerFactory-ISAPI-2.0-64" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" />

I even tried adding in my own handler for aspx that looked like this:

<add name="aspx" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness64" />

The only thing that did was change the Handler part of the error notification to say IsapiModule.

The odd thing is that this error only occurs the first time (or when the server has been idle for hours). As soon as I see this error, if I refresh the page it's all fine and dandy again.

I even tried deleting the web.config file and that did absolutely nothing.

I can't seem to find a single answer for this problem on the internet.

Edit: I enabled Failed Request Tracking and this is what it shows:

MODULE_SET_RESPONSE_ERROR_STATUS
Warning ModuleName="IsapiModule", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="500", HttpReason="Internal Server Error", HttpSubStatus="0", ErrorCode="The operation identifier is not valid.
(0x800710dd)", ConfigExceptionInfo=""

And right before the error it shows:

NOTIFY_MODULE_START ModuleName="IsapiModule", Notification="EXECUTE_REQUEST_HANDLER", fIsPostNotification="false", fIsCompletion="false"

Now when I compare this to a successful run the difference is that the error produces MODULE_SET_REPONSE_ERROR_STATUS whereas the successful run doesn't (and then goes on to produce the correct HTML output).

Edit: I took a simple app and tried to get that running and I received the same error. But when the apppool was in Integrated mode it ran fine! Unfortunately I cannot migrate our app to integrated for reasons I cannot specify but I narrowed it down to the app pool. Also I don't have to restart the server to repro the error, instead recycling the app pool will do.

Summary:
- As mentioned below there's nothing in the Event Logs to indicate failure. I combed through all logs in Event Viewer

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

谁的新欢旧爱 2024-08-06 06:41:43

最好的办法是在网站的 IIS 部分启用失败请求跟踪。 然后,您可以启用一些过滤器,为您提供更详细的信息。

您可以通过 IIS 管理器执行此操作。 单击您的网站,然后在功能视图的 IIS 部分中,双击“失败请求跟踪规则”。

它很可能尚未启用,因此从最右边的列中选择“编辑站点跟踪”。 选中“启用”复选框并记下该目录。

然后,您可以在该屏幕中添加规则,或者转到您的应用程序并从那里打开“失败请求跟踪规则”IIS 功能。

再次从最右边的列中单击“添加...”,然后完成向导并设置日志记录。

加载再次引发错误的页面。 转到日志记录文件夹并双击 XML 文件。 该目录中有一个 XSL。 不要用核武器摧毁它,因为一旦它消失了,它就不会被重新创建。 :s 转换后的 XML 将向您显示比您希望的更多的信息。

我今天晚上就用它来发现我配置的自定义错误页面使用 ~/ 而不是“/”,导致 IIS 死机。

Best thing to do is enable Failed Request Tracing in the IIS section of the web site. You can then enable some filters which give you much more detailed information.

You can do this through the IIS Manager. Click your web site, then in the IIS section of the Features View, double-click "Failed Request Tracing Rules".

It's most likely not already enabled, so from the rightmost column select "Edit Site Tracing". Check the "Enable" checkbox and make note of the directory.

You can then either add a rule in that screen or go to your application and open the "Failed Request Tracing Rules" IIS feature from there.

From the rightmost column again, click "Add..." Then go through the wizard and set up the logging.

Load your page that's throwing the error again. Go to the logging folder and double-click the XML file. There's an XSL in that directory. Don't nuke it, cuz once it's gone it won't get recreated. :s The transformed XML will show you more info than you can possibly hope for.

I just this evening used that to discover a custom error page that I configured was using ~/ instead of "/", causing IIS to die.

甜宝宝 2024-08-06 06:41:43

当 ASP.NET 应用程序开始加载时,您可能有一些代码需要很长时间才能执行,可能是太大的应用程序变量或资源初始化。

最好的方法是设置某种 ping 监视器,许多 ISP 提供 ping 监视器,可以定期监视您的 html url,这可能有助于保持您的应用程序始终处于活动状态!

尝试查看您的 ASP.NET 应用程序的初始化过程,您可能需要增加一些超时值!

When ASP.NET application starts loading, you may have some code that may take too long to execute, probably too big application variables or resources initialization.

The best way is to setup some sort of ping monitor, lot of ISPs provide pinging monitors that can monitor your html url on regular interval, that may help keeping your application all time alive !!

Try looking into initialization procedures of your asp.net app, you may want to increase some timeout values !!

隱形的亼 2024-08-06 06:41:43

听起来像是启动应用程序池时发生的事情。 但它应该在事件查看器中记录实际错误。 或者您可以关闭 CustomErrors 来调试它。 问题是,您需要查看实际错误才能弄清楚发生了什么。

Sounds like something while starting up the app pool. But it should be logging the actual error in the event viewer. Or you could turn CustomErrors off to debug it. The thing is, you need to see the actual error to figure out what's going on.

放肆 2024-08-06 06:41:43

您的 ASPX 代码中是否有未处理的异常处理程序(例如 Global Application_Error)?

如果异常来自 ASPX 代码,您应该能够捕获该异常并记录它(这是很有可能的)。

我以前见过这样的零星错误,但现在我不记得根本原因了。

如何:处理应用程序级错误

Do you have an unhandled exception handler in your ASPX code (something like Global Application_Error)?

You should be able to catch the exception and log it if it's coming from the ASPX code (which is quite possible).

I've seen sporadic errors like this before, I just can't remember the underlying cause at the moment.

How to: Handle Application-Level Errors

此刻的回忆 2024-08-06 06:41:43

好吧,我不知道是什么导致了这个问题,但是我使用的虚拟机的全新安装修复了它。 欢呼!

Well I don't know what was causing this but a clean install of the VM I was using fixed it. Hurrah!

雪若未夕 2024-08-06 06:41:43

您必须将此脚本添加到您的 web.config 中:

<system.webServer>
    <handlers>
        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </handlers>

我希望这有帮助! 欢呼。

You must add this script on your web.config:

<system.webServer>
    <handlers>
        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </handlers>

I hope this help ! Cheer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文