我正在尝试部署一个ASP。网络应用程序。我已经将网站部署到IIS,但当用浏览器访问它时,它显示给我这个:
服务器错误 500 -内部服务器错误。 您正在查找的资源有问题,无法显示。
在摆弄了网页之后。配置,我得到:
由于内部服务器错误,页面无法显示。
我如何才能看到这个服务器错误背后的实际问题?
我正在尝试部署一个ASP。网络应用程序。我已经将网站部署到IIS,但当用浏览器访问它时,它显示给我这个:
服务器错误 500 -内部服务器错误。 您正在查找的资源有问题,无法显示。
在摆弄了网页之后。配置,我得到:
由于内部服务器错误,页面无法显示。
我如何才能看到这个服务器错误背后的实际问题?
当前回答
对于iis10,除了更改customErrors=Off来显示错误内容外,还有一个额外的步骤要做。
<system.web>
<customErrors mode="Off" />
</system.web>
<system.webServer>
<httpErrors existingResponse="PassThrough" errorMode="Detailed"/>
</system.webServer>
Raul在这个链接中回答了这个问题:关闭IIS8自定义错误
其他回答
如果您正在使用自定义HttpHandler(即实现IHttpModule),请确保您正在检查对其Error方法的调用。
你可以让你的处理程序在本地调试期间抛出实际的httpexception(它有一个有用的Message属性),如下所示:
public void Error(object sender, EventArgs e)
{
if (!HttpContext.Current.Request.IsLocal)
return;
var ex = ((HttpApplication)sender).Server.GetLastError();
if (ex.GetType() == typeof(HttpException))
throw ex;
}
还要确保检查异常的InnerException。
可能是你的网。配置文件错误或缺少一些标签。我使用正确的。net 4配置标记解决了这个问题。
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Deployment, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<authentication mode="None"/>
</system.web>
如果您正在使用IIS 8.5,可能需要将ApplicationPool ID设置从ApplicationPoolId更改为NetworkService
右键单击有问题的应用程序池,单击“高级设置”,然后向下滚动到ID——它可能会被设置为ApplicationPoolIdentity。单击按钮(..)并从下拉列表中选择NetworkService。
此外,如果是. net 2.0应用程序,请确保在应用程序池中没有引用4.0框架。
我在这个问题上非常紧张。确保下面的条目在根网络中。配置文件为我修复了它:
<configuration>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
</configuration>
请记住,如果已有XML元素,则必须将其添加到现有的XML元素中。不能只在文件末尾添加,因为任何元素都不能有多个副本。
对我来说,下面的代码在网上。Config是罪魁祸首。当我删除它时,网站运行正常。
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
</staticContent>