HTTP 500内部错误 - IIS网站

5
我已经在装有Windows Server 2008 R2的环境中安装了SP 2010。我一直使用VS 2010开发SP 2010的应用程序页面。
我使用wsp builder将所有的dll、页面、脚本和图像打包成一个解决方案包,并部署到Web应用程序中。
一切都很顺利,但突然间我的Web应用程序开始出现“HTTP 500内部服务器错误”,这是在我对应用程序页面进行了一些重大更改并部署后发生的。
我尝试创建新的Web应用程序,但没有任何好处。请问这个问题的根源是什么?
谢谢, Raghuraman.V
3个回答

11

通过编辑Web.config和applicationhost.config解决了这个问题。 可以在C:\ Users \\ Documents \ IISExpress \ config中找到配置文件,或者右键单击托盘上的IIS Express图标并查看所有应用程序,然后单击所需网站,再单击配置文件链接。

将其注释掉

<error statusCode="500" prefixLanguageFilePath="%IIS_BIN%\custerr" path="500.htm" />

将父节点设置为 <httpErrors errorMode="DetailedLocalOnly"

将 httpErrors 设置为 Allow

<section name="httpErrors" overrideModeDefault="Allow" />

修改你的Web项目的web.config文件中的HttpErrors节点

<httpErrors errorMode="Custom" existingResponse="Auto">

那应该就解决了,这基本上意味着“我不想让IIS Express覆盖我的站点配置”。


发布的评论已删除 HTML,请参见下面应该在帖子中的内容。注释掉 error statusCode="500" prefixLanguageFilePath="%IIS_BIN%\custerr" path="500.htm" 将父节点设置为 httpErrors errorMode="DetailedLocalOnly"将 httpErrors 设置为 Allow section name="httpErrors" overrideModeDefault="Allow"更改您的 Web 项目 web.config HttpErrors httpErrors errorMode="Custom" existingResponse="Auto" - Atif Rehman
你只需要使用代码块选项来格式化答案,我已经为你修复了答案。 - Stephen
3
谢谢,这是我第一次发布 :-) - Atif Rehman
1
没关系,我们都曾经是新手 :) - Stephen
1
这帮助我们找到了错误的详细信息,我刚刚将<httpErrors errorMode="DetailedLocalOnly" existingResponse="Replace" defaultResponseMode="ExecuteURL"> 更改为<httpErrors errorMode="Custom" existingResponse="Auto"> 然后错误详细信息就出现了。非常感谢这个解决方案! - NiL
希望我能够点赞更多。这个答案在2022年仍然拯救着人们的生命(尤其是我的)。 - Andrew Steitz

7

为了解决问题,您应该首先指示IIS显示详细的错误信息,而不仅仅是“500”。

调整您的web.config文件,并将自定义错误设置为关闭:

<customErrors mode="Off" />

(区分大小写)。
另外,如果您正在使用Internet Explorer,请关闭高级选项“显示友好错误消息”。

1
@以上,感谢您的回复...我已经将自定义错误设置为关闭。除此之外,如果我关闭“显示友好的错误消息”,我会得到一个空白屏幕,这对我也没有任何帮助。 - Raghu
也许直接在 Web 服务器上使用浏览器请求 URL 会有所帮助。此外,检查 Web 服务器的事件日志,错误信息也应该被记录在那里。 - Uwe Keim
1
我检查了Windows事件查看器和IIS日志。我怀疑这与我们的域控制器有关。我偷偷进入事件查看器,只是为了找到这个错误:“此工作站与主域之间的信任关系失败。”是否有可能由于域控制器问题导致页面请求失败? - Raghu

2
为了帮助他人,这里提供了一份指南,帮助我找到了设置中的问题(感谢Rick Barber):解决500内部服务器错误
  1. Load the site from a browser located on the same server. In IE you may need to turn off ‘show friendly http errors.’
  2. Temporarily add the following within the appropriate tags in your web.config file:

    <configuration>
        <system.webServer>
            <httpErrors errorMode="Detailed" />
        </system.webServer>
        <system.web>
            <customErrors mode="Off" />
            <compilation debug="true" />
        </system.web>
    </configuration>
    
  3. Open up IIS Manager and try to open up some of the different features by double clicking on the icon. If there is an error in the web.config file and it can’t even parse it, sometimes you will get a helpful error.

  4. Look in Windows Event Viewer. Sometimes you can find the detailed error logged in there, particularly Application Event Viewer.
  5. Setup Failed Request Tracing. This is especially helpful if it is an intermittent 500 error.
  6. Look through the web log files. This is especially helpful for an intermittent 500 error. You can often parse the log files to see if there is a trend with a specific page that is throwing a 500 error.

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接