Deploying website: 500 - Internal server error

后端 未结 22 2213
情深已故
情深已故 2020-11-21 23:30

I am trying to deploy an ASP.NET application. I have deployed the site to IIS, but when visiting it with the browser, it shows me this:

Server Error

相关标签:
22条回答
  • 2020-11-22 00:14

    If you're using a custom HttpHandler (i.e., implementing IHttpModule), make sure you're inspecting calls to its Error method.

    You could have your handler throw the actual HttpExceptions (which have a useful Message property) during local debugging like this:

        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;
        }
    

    Also make sure to inspect the Exception's InnerException.

    0 讨论(0)
  • 2020-11-22 00:17

    500 Internal Error
    Windows Hosting Error

    Godaddy Hosting issue

    I have been facing the same issue, but now my issue has been resolved. Always use in this hosting this it works.

    I will also recommend you all to do whatever changes you are looking to make in your web.config file. Please do it one by one and test the same on the live domain so that you can find the exact problem or the features that your hosting provider does not allow you to use.

    <?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>
    
    0 讨论(0)
  • 2020-11-22 00:18

    I finally solved this "500 Internal server" error when deploying the ASP.NET MVC 3.0 application on godaddy.ocm shared hosting.

    somehow there were discrepancies on the version of DLL files referenced and version mentioned in file web.config.

    I tried all the options mentioned in various forum. Nothing helped, although everyone suggested the same kind of fix, but somehow it didn't work in my scenario. Finally after banging my head for two days. I decided to delete all DLL file reference and delete web.cofig (make a local copy) from the project and let the application throw the error and then add the DLL files one by one making copy to local=true.

    After all the DLL files were added, I created a new ASP.NET MVC application and copied the web.config of new application to my actual application. So my actual application now has a new web.config, and then I copied the connectionstring and other references from the local copy of web.config that I saved.

    I just compiled the application and published to a local folder and FTP the published folder to goDaddy.

    It worked and finally my problem was solved.

    0 讨论(0)
  • 2020-11-22 00:19

    First, you need to enable and see detailed errors of your web messages, because this is a general message without giving information on what's really happening for security reasons.

    With the detailed error, you can locate the real issue here.

    Also, if you can run the browser on the server, you get details on the error, because the server recognizes that you are local and shows it to you. Or if you can read the log of the server using the Event Viewer, you also see the details of your error.

    On IIS 6

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

    On IIS 7

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

    Note: You can avoid the Debug=true. You only need to close the custom errors for a while and get the detailed error page.

    Reference: Enabling Windows custom error messaging in Go Daddy's help articles.

    Also, this can help: How to enable the detailed error messages (from IIS).

    0 讨论(0)
提交回复
热议问题