3

I am getting a Internal Server 500 error after deploying an application that has compiled without errors on my local machine. The server that the application is deployed on has a ton of security so I need to specify read and write access for every directory. This application uses windows authentication and a web service to populate drop down boxes via a proxy. I think there might be an issue connecting to the web service or an issue with the read/write security on the files, or an issue with the active directory authentication.

I edited the web.config so that it would display more information as to the cause of the error with the following code:

<system.web>
  <customErrors mode ="Off"></customErrors>
  <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
  <trace enabled="true" pageOutput="true" />

  <authentication mode="Windows"/>
   <authorization>
    <allow roles="alg\ADMIN_USER" />
    <deny users="*" />        
  </authorization> 

<client>
  <endpoint address="http://63.236.108.91/aCompService.svc" binding="basicHttpBinding"
    bindingConfiguration="BasicHttpBinding_IAcompService" contract="aComp_ServiceReference.IAcompService"
    name="BasicHttpBinding_IAcompService" />
</client>

I am now getting the following Error:

    500 - Internal server error.

    There is a problem with the resource you are looking for, and it cannot be 
    displayed. 

I would like to see the stack trace with the source of the error.

What am I supposed to put in the web.config file so it displays the full stack trace?

What needs to be changed on the website from locally run to deployment?

Update- The deployment guy lifted some security read/write restrictions and now I get

    Parser Error Message: The connection name 'ApplicationServices' was not found in 
    the applications configuration or the connection string is empty. 

To get rid of the error, I removed the AspNetSqlRoleProvider declared on Line 72 and still got an error. I then removed the AspNetWindowsTokenRoleProvider and all the provider info and got the following Error:

    Exception message: Default Role Provider could not be found.  

Our hosting is done all remotely but the server guy can login to the local webserver remotely. It looks like the server guy didn't post the files in the right place. Now, I now get the error:

    There is a problem with the resource you are looking for, and it cannot 
    be displayed.

Any ideas on how to fix these issues?

Thanks for looking!

Brian McCarthy
  • 4,658
  • 16
  • 49
  • 66
  • 1
    "Off" should do it...that is strange. – Josh M. May 06 '11 at 21:10
  • If using a DB, check the connection string :) – IrishChieftain May 06 '11 at 21:16
  • @GalacticCowboy, I accessed the site remotely. Our hosting is done all remotely. It looks like the server guy didn't post the files in the right place. Now, I now get the error: There is a problem with the resource you are looking for, and it cannot be displayed. I think there might be an issue connecting to the webservice. I have proxies that get the information for the drop down boxes for the application. – Brian McCarthy May 10 '11 at 13:49
  • @IrishChieftain, I'm not using a DB connection string but a webservice – Brian McCarthy May 10 '11 at 14:01
  • @Josh M, I updated the question, check it out now and let me know what you think plz – Brian McCarthy May 10 '11 at 14:02
  • You need to post the actual exception. Check the Event Log and see if there is any more information there. – Josh M. May 10 '11 at 14:16
  • @Josh M, Nothing is showing up in the event log. What else should I change on the code to make it show the error? – Brian McCarthy May 10 '11 at 14:59
  • By default, WCF errors don't get put in the event log. You'll need to add a trace listener in the web.config, configured to publish the errors to the event log, to a file, etc. – GalacticCowboy May 10 '11 at 15:26
  • Also, even with remote hosting, are you able to access the server console via remote desktop? – GalacticCowboy May 10 '11 at 15:28
  • @GalacticCowboy, what do you think of my code for adding a trace listener below? Update- The deployment guy lifted some security read/write restrictions and now I get Parser Error Message: The connection name 'ApplicationServices' was not found in the applications configuration or the connection string is empty. To get rid of the error, I removed the AspNetSqlRoleProvider declared on Line 72 and still got an error. I then removed the AspNetWindowsTokenRoleProvider and all the provider info and got the following Error / Exception message: Default Role Provider could not be found. – Brian McCarthy May 11 '11 at 18:28
  • I'm getting the following error now - Could not find default endpoint element - http://stackoverflow.com/questions/352654/could-not-find-default-endpoint-element – Brian McCarthy May 16 '11 at 13:57

3 Answers3

1

Do you have a web.config at another location in the application's folder hierarchy that could be overriding the change you're making? I've seen confusion before when devs have copied a web.config up a level to retain a copy of it while making test changes.

That can be a source of much head-scratching.

dommer
  • 19,610
  • 14
  • 75
  • 137
1

Perhaps using impersonation should help? I added the following in web.config:

  <authentication mode="Windows"/>
  <identity impersonate="true"/>

I added WriteToEventLog code so that I can track errors in the event log by the method.

    Catch Ex As Exception
        WriteToEventLog(Ex.Message, "GetCarriers-Method", EventLogEntryType.Error, "aComp-utility")


    Catch ex As Exception
        WriteToEventLog(ex.Message, "GetMarketingCompanies-Method", EventLogEntryType.Error, "aComp-utility")

Perhaps adding a TraceListenerLog should help?

Reference MSDN for more info on this code. I added the following in web.config:

 <configuration>
   <system.diagnostics>
     <trace autoflush="false" indentsize="4">
       <listeners>
         <add name="myListener"
           type="System.Diagnostics.EventLogTraceListener"
           initializeData="TraceListenerLog" />
       </listeners>
     </trace>
   </system.diagnostics>
 </configuration>

should i also add the following on default.aspx.vb ?

Overloads Public Shared Sub Main(args() As String)

' Create a trace listener for the event log.
Dim myTraceListener As New EventLogTraceListener("myEventLogSource")

' Add the event log trace listener to the collection.
Trace.Listeners.Add(myTraceListener)

' Write output to the event log.
Trace.WriteLine(myTraceListener)

End Sub 'Main
Brian McCarthy
  • 4,658
  • 16
  • 49
  • 66
1

I was able to over come this same problem by making a copy of my config file and then removing one segment and then testing the results one step at a time. What I discovered is that after I removed my handelers it worked fine.