开发者

ASP.NET - Deployment Issues - Enabling Stack Trace / Trace Listener Log via the Web.Config to find the cause of Internal Server 500 Error

开发者 https://www.devze.com 2023-03-04 12:04 出处:网络
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 n

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!


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.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消