7

Web config has debug=true and the project is a debug build and the pdb files are present in the bin directory, but I do not get line numbers in my stacktrace when an exception is thrown.

Works fine with local IIS/Cassini but not on our test IIS servers. Is there some obvious setting that I might be missing?

Graeme
  • 2,597
  • 8
  • 37
  • 50

4 Answers4

9

It turns out using impersonation with the web.config:

<identity impersonate="true" />

causes the loss of the line numbers in the stacktrace. I took the entry out and my line numbers returned, put it back and after a few hours (Kerberos ticket refreshing?) the line numbers disappeared again.

Not sure why impersonation affects the stack trace but it does - would be happy to have someone confirm / explain this...

Graeme
  • 2,597
  • 8
  • 37
  • 50
  • Someone else noticed it in 2nd last post of this thread, but no explanation given: http://channel9.msdn.com/forums/TechOff/257195-Getting-line-number-in-Exception-for-ASPNET/ – Graeme Apr 22 '10 at 08:55
  • Thank you Graeme, Thank you, Thank you, Thank you. I've spent 8+ hours trying to fix the same issue and after trying everything I could think of and everything I couldn't think of, this was the solution. I need impersonation for some of my websites but those websites have line numbers. For an unknown reason, this particular website had no line numbers and turning off impersonate it in the local web.config solved the problem. THANK YOU!!! – Chris Porter Dec 03 '10 at 16:53
  • 1
    Just had the same problem here. I would guess what's happening is that when the DLL is loaded the thread is running as the standard ASP.Net identity but when the exception happens and it wants to generate the stack trace, the thread is running as the calling user who doesn't have access to read the PDB file. Our application requires impersonate=true to work but we resolved it by allowing everyone full control access on the PDB file. – Andy Feb 22 '12 at 15:29
  • According to MSDN: "Impersonation can significantly affect performance and scaling." [See ASP.NET Impersonation](http://msdn.microsoft.com/en-us/library/aa292118(v=vs.71).aspx). So there is a downside unfortunately.. – Kapé Apr 07 '14 at 15:41
2

According to question 4130956: If impersonate="true", to get line numbers in the stack trace, you need to assign the 'Debug Programs' user right to the account that you are using to log in.

Community
  • 1
  • 1
user281806
  • 1,020
  • 9
  • 14
1

Check the MAchine.Config file

In ASP.NET 2.0 there is a switch that can be turned on in machine.config that turns off all debug=true, so in 2.0 applications you can do this directly without worrying about finding out which applications do and don’t have it.

<system.web>

      <deployment retail=”true”/>

</system.web>

Sources from http://blogs.msdn.com/tess/archive/2006/04/13/575364.aspx

Dave Walker
  • 3,498
  • 1
  • 24
  • 25
  • I tried this on the local machine and it actually completely turns off the trace - only the exception text is returned. With the default I get the trace, just no file names and line numbers present. – Graeme Apr 20 '10 at 08:55
0

Maybe this could help, until you can find a better solution:

alexandrul
  • 12,856
  • 13
  • 72
  • 99