我正在尝试部署一个ASP。网络应用程序。我已经将网站部署到IIS,但当用浏览器访问它时,它显示给我这个:

服务器错误 500 -内部服务器错误。 您正在查找的资源有问题,无法显示。

在摆弄了网页之后。配置,我得到:

由于内部服务器错误,页面无法显示。

我如何才能看到这个服务器错误背后的实际问题?


当前回答

除了其他建议之外,请确保将httpErrors节点的现有response属性从Replace更改为Auto,或者完全删除该属性。

<httpErrors existingResponse="Replace" />
                              ^^^^^^^ not going to work with this here

其他回答

首先,您需要启用并查看web消息的详细错误,因为出于安全原因,这是一个一般性消息,没有提供关于实际发生情况的信息。

有了详细的错误,您可以在这里找到真正的问题。

此外,如果您可以在服务器上运行浏览器,则可以获得有关错误的详细信息,因为服务器识别出您是本地的,并将其显示给您。或者,如果您可以使用事件查看器读取服务器的日志,则还可以看到错误的详细信息。

第6页

<configuration>
    <system.web>
        <customErrors mode="Off"/>
        <compilation debug="true"/>
    </system.web>
</configuration>

第7页

<configuration>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
        <asp scriptErrorSentToBrowser="true"/>
    </system.webServer>
    <system.web>
        <customErrors mode="Off"/>
        <compilation debug="true"/>
    </system.web>
</configuration>

注意:你可以避免Debug=true。您只需要暂时关闭自定义错误,并获得详细的错误页面。

这可以帮助:如何启用详细的错误消息(从IIS)。

就我而言,我把一个错误放在我的网。配置文件。应用程序键以某种方式放在<appSettings>标记下。但是我想知道为什么它没有显示配置错误。错误500对于调查这个问题来说太一般了。

Before changing the web.config file, I would check that the .NET Framework version that you are using is exactly (I mean it, 4.5 != 4.5.2) the same compared to your GoDaddy settings (ASP.Net settings in your Plesk panel). That should automatically change your web.config file to the correct framework. Also notice that for now (January '16), GoDaddy works with ASP.Net 3.5 and 4.5.2. To use 4.5.2 with Visual Studio it has to be 2012 or newer, and if not 2015, you must download and install the .NET Framework 4.5.2 Developer Package. If still not working, then yes, your next step should be enabling detailed error reporting so you can debug it.

有时,原因可能是您的.dll程序集没有在服务器上正确注册。

例如,您可以在安装了Office的本地机器上成功运行c# Excel web应用程序,但在服务器部署时得到500错误,因为服务器上没有安装Office套件,因此您得到服务器错误。

500内部错误 Windows主机错误 Godaddy托管问题

我一直面临着同样的问题,但现在我的问题已经解决了。总是在这个主机上使用,它是有效的。

我也会建议大家做任何你想要在你的网站上做的改变。配置文件。请逐个执行,并在活动域中进行相同的测试,以便您可以找到确切的问题或托管提供商不允许您使用的功能。

<?xml version="1.0"?>

<configuration>
    <system.web>
        <trust level="Medium"/>
        <compilation debug="true" targetFramework="4.5">
            <assemblies>
                <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            </assemblies>
        </compilation>

        <httpRuntime targetFramework="4.5" />
        <sessionState mode="InProc" cookieless="false" timeout="90" />
        <authentication mode="Forms">
            <forms loginUrl="default.aspx"  
                   defaultUrl="default.aspx"
                   protection="All"
                   cookieless="UseCookies"
                   slidingExpiration="false"
                   timeout="30"
                   name="aeon.corpusjuris.in" />
        </authentication>

        <customErrors 
            mode="Off" 
            defaultRedirect="errorpage.aspx">

            <error statusCode="403" redirect="errorpage.aspx"/>
            <error statusCode="404" redirect="errorpage.aspx"/>
        </customErrors>

        <!--  <httpModules>
                <add name="HTTPCaching" type="HTTPCaching"/>
            </httpModules>
        -->
    </system.web>

    <runtime>
        <performanceScenario value="HighDensityWebHosting"  />
    </runtime>

    <system.webServer>
        <!--  <modules runAllManagedModulesForAllRequests="true">
                <add name="HTTPCaching" type="HTTPCaching"/>
            </modules>
        -->

        <defaultDocument>
            <files>
                <clear />
                <add value="default.aspx" />
            </files>
        </defaultDocument>

        <httpErrors errorMode="Detailed" />
        <asp scriptErrorSentToBrowser="true"/>

        <staticContent>
            <clientCache cacheControlCustom="public"
                         cacheControlMaxAge="60:00:00"
                         cacheControlMode="UseMaxAge" />
        </staticContent>
    </system.webServer>

    <system.web.extensions>
         <scripting>
             <webServices>
                 <jsonSerialization maxJsonLength="90000000">
                 </jsonSerialization>
             </webServices>
         </scripting>
    </system.web.extensions>

</configuration>