500 - Internal server error

Discussion in 'Windows / IIS' started by jmagaram, Sep 24, 2009.

  1. My web site works fine on my local development system which is Vista. My standard practice is to upload it to a sub-directory of my main web site called "Test" and make sure it works up there. And if it does work, I upload the site to the root of my web site - my live site. I've been doing this just fine for more than a year now with many updates. But for some reason now my web site works locally but I get "500 - Internal server error" when attempting to open the default.aspx page in my Test directory. I have no clue why this is happening. A couple days ago I added support for ASP.net dynamic data but I'm pretty sure my site worked fine since I did this. What causes the "500 - Internal server error" and how can I fix it?

    My web site is www.timesupkidz.com/test
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    500 error is a generic application error.
     
  3. What is the approach for debugging this type of thing? There is no data to go on.
     
  4. ...Are you aware of Health Monitoring for ASP.NET?
    There's a lot of info on it on MSDN.
    You can log site page errors to SQL Server and/or have your site Email them to you.
    If you want to give it a try and need help let me know.
    All the best,
    Mark
     
  5. Thanks for the suggestion. I've having trouble getting it working though. I created the SQL tables using the aspnet_regsql.exe tool described in http://msdn.microsoft.com/en-us/library/ms998306.aspx. And I updated by web.config as shown below. But the SQL logging isn't working. I purposely throw an exception on one of my pages and it gets logged to the eventlog but not SQL. I assume the problem is that maybe the permissions aren't correct on the SQL tables or stored procedure. According to the MSDN article I need to "Create a SQL Server logon for your Web application's identity. For example, create a network service and then create a database user for this logon in the Aspnetdb database. Grant the database user execute permission on the aspnet_WebEvent_LogEvent stored procedure." I don't know how to do this and/or find it confusing. I've tried making "dbo" a member of the aspnet_WebEvent_FullAccess database role but get an error. I can't seem to add "SQL2008_474213_raincity_user" to that role either, or add a new login for it.

    Regardless, I can't seem to get any data about the 500 error. I tried putting diagnostic output in the Application_Error and Application_Start events, but nothing is getting output. I don't think my application is getting loaded at all on the server, even though it works fine on my local computer.

    <connectionStrings>
    <add name="healthMonitorConnectionString" connectionString="Data Source=sql2k801.discountasp.net;Initial Catalog=SQL2008_474213_raincity;User ID=SQL2008_474213_raincity_user;Password=mypasswordhere" providerName="System.Data.SqlClient"/>
    </connectionStrings>

    <healthMonitoring enabled="true">
    <eventMappings>
    <clear />
    <add name="All Errors" type="System.Web.Management.WebBaseErrorEvent" startEventCode="0" endEventCode="2147483647" />
    </eventMappings>
    <providers>
    <clear />
    <add name="EventLogProvider" type="System.Web.Management.EventLogWebEventProvider" />
    <add name="SqlWebEventProvider" connectionStringName="healthMonitorConnectionString" maxEventDetailsLength="1073741823" buffer="false" type="System.Web.Management.SqlWebEventProvider" />
    </providers>
    <rules>
    <clear />
    <add name="All Errors Default" eventName="All Errors" provider="EventLogProvider" profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:00:00" />
    </rules>
    </healthMonitoring>
     
  6. ...I'll try and test the SQL version of this over the weekend.
    If you want my Email version let me know.
    All the best,
    Mark
     
  7. I think that part of the problem is that my "test" folder/web-application, which is a subdirectory of my main web site, is not totally independent of the main web site. For example, if I attempt to access a page on the sub-site and that page does not exist, then I end up seeing the custom error page as defined in the web.config on the main site. So maybe my whole approach for beta-testing web sites is wrong. I was hoping that my "test" subdirectory would have totally isolated/independent behavior from the parent web site. I still am not confident I can get the SQL permissions set up properly, though.
     
  8. ...I enjoyed reading that and I have done the same sort of them for years, good practice.
    We can keep "dependence" out of test folders but I can't think of a good site isolation.
    On IIS7 I rather like the default error pages, they are more informative than previous IIS servers.
    On the IIS7 Test server here I created an error catch page and a Webcast to go with it.
    It's handy and does what it should but when running tests the default IIS7 error page is sometimes what I'd rather have. ;-)
    The Webcast is here if you're on IIS7 you may want to watch:
    http://iis7test.com/webcasts/
    (Webcasts 6 and 7)
     
  9. I backed up my main site and copied the new one to the root level folder. It works. So apparently there was some problem with running my site in a sub-folder. Maybe the problem had to do with inherited web.config settings? I really don't know.
     

Share This Page