Error tracing on page

G

Guest

I understand it is built in behaviour that if an ASP.NET's web.config is set
to:
<customErrors
mode="RemoteOnly"
/>

then I only get a detailed error message on screen when the ASP.NET
application is executed on the IIS server itself. However, I note that
with the following

<customErrors
mode="Off"
/>

Whereas I could get a full detailed trace including line number and
stack-trace like the following on the IIS server on which the application was
developed (Windows XP Professional SP1, .NET Framework 1.1, Visual Studio
..net 2003):
Server Error in '/app8156' Application
--------------------------------------------------------------------------------

Could not find a part of the path "c:\test\app8156\xml\FormB.xml".
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a
part of the path "c:\dev\app8156\xml\FormB.xml".

Source Error:


Line 43: // Put user code to initialize the page here
Line 44: xmlFormInstance = new XmlDocument();
Line 45: xmlFormInstance.Load(Request.PhysicalApplicationPath + "xml\\"+
Request.QueryString["form"]+".xml");
Line 46: TestString = "";
Line 47: if (Request.QueryString["ro"]=="1")


Source File: c:\dev\app8156\usercontrols\showform.ascx.cs Line: 45

Stack Trace:


[DirectoryNotFoundException: Could not find a part of the path
"c:\dev\app8156\xml\Form B.xml".]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +287
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean
bFromProxy) +888
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share) +45
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials) +73
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type
ofObjectToReturn) +55
System.Xml.XmlTextReader.CreateScanner() +384
System.Xml.XmlTextReader.Init() +23
System.Xml.XmlTextReader.Read() +530
System.Xml.XmlValidatingReader.ReadWithCollectTextToken() +146
System.Xml.XmlValidatingReader.Read() +26
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean
preserveWhitespace) +80
System.Xml.XmlDocument.Load(XmlReader reader) +72
System.Xml.XmlDocument.Load(String filename) +78
app8156.UserControls.ShowForm.OnInit(EventArgs e) in
c:\dev\app8156\usercontrols\showform.ascx.cs:45
System.Web.UI.Control.InitRecursive(Control namingContainer) +241
System.Web.UI.Control.InitRecursive(Control namingContainer) +179
System.Web.UI.Control.InitRecursive(Control namingContainer) +179
System.Web.UI.Page.ProcessRequestMain() +174




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573

When I copy the whole virtual directory (including the whole bin folder
containing debug info) to a Windows 2003 web server, I only get the following
partial information:
Server Error in '/app8156' Application
--------------------------------------------------------------------------------

Could not find a part of the path "X:\InetPub\wwwroot\app8156\xml\FormB.xml".
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a
part of the path "G:\InetPub\WebApps\app8156\xml\FormB.xml".

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:


[DirectoryNotFoundException: Could not find a part of the path
"G:\InetPub\WebApps\app8156\xml\FormB.xml".]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +287
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean
bFromProxy) +888
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share) +45
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials) +73
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type
ofObjectToReturn) +55
System.Xml.XmlTextReader.CreateScanner() +384
System.Xml.XmlTextReader.Init() +23
System.Xml.XmlTextReader.Read() +530
System.Xml.XmlValidatingReader.ReadWithCollectTextToken() +146
System.Xml.XmlValidatingReader.Read() +26
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean
preserveWhitespace) +80
System.Xml.XmlDocument.Load(XmlReader reader) +72
System.Xml.XmlDocument.Load(String filename) +78
app8156.UserControls.ShowForm.OnInit(EventArgs e) in
c:\dev\app8156\usercontrols\showform.ascx.cs:45
System.Web.UI.Control.InitRecursive(Control namingContainer) +241
System.Web.UI.Control.InitRecursive(Control namingContainer) +179
System.Web.UI.Control.InitRecursive(Control namingContainer) +179
System.Web.UI.Page.ProcessRequestMain() +197




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032

How can I enable my test IIS6 server with ASP.NET Framework 1.1 to display
full debug information?

Many Thanks
 
S

Steven Cheng[MSFT]

Hi,

Welcome to ASPNET newsgroup.
As for the "full debug information" you mentioned, it was just as you have
found, depend on the configruation in the application config
file(web.config) 's

<customErrors ... /> element.

the default setting mode="RemoteOnly" all the Remote client side can't see
the detailed error info( exception message, call stack...). When we use
mode="Off" that means we disable customized error function so that all the
client (no matter local or remote) are able to view the detailed error.

Also, i'm not very sure on the
===============
How can I enable my test IIS6 server with ASP.NET Framework 1.1 to display
full debug information?
===============

you mentioned at the end of your last message, do you mean that you'd like
to enable the displaying detail error info setting for all the ASP.NET
applications on your server or any other requirement? If you want to make
a machine scope configuration, you can consider setting this in the
machine.config so that by default all the asp.net application on that
server will override it.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

Steven, Thanks for replying.

As you see from my original post, even with the following settings in
Web.config, I don't get the line number, of the error source when the ASP.NET
1.1 code (compiled from Visual Studio .NET 2003 on WinXP Pro SP1, IIS5.1) is
taken across to a shared development server running Windows Server 2003
IIS6.0 ASP.NET 1.1
<customErrors mode="Off" />

Could there have been any security restrictions that prevent the line
number, etc. from being displayed? Note, the .pdb file had indeed been
copied over!
 
S

Steven Cheng[MSFT]

Thank you for the response,

Based on my local test, we can correctly get the detailed error message and
line number in source code as long as we're deploying the "debug" version
of our applciation's assembly. If we change the assembly's build versino to
"release" , then the line number won't display (no matter you've provided
the pdb or not), since there' no symbol info in the assembly.

So have you checked whether the app's assemly you deployed to your 2003
IIS6 server is debug or release? If release, you can try changing it to
debug version and test again.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

The project was compiled as "Debug", and the whole website was copied over to
the Windows 2003 server's IIS6's virtual directory.

So there are no security lock down that could prevent the line number from
being displayed?
 
S

Steven Cheng[MSFT]

Thanks for the response,

Yes, as long as the deployed assembly has the symbols associated with it,
we should be able to get the source code line number in the exception page(
generally the debug version is capable of this). I'm not sure whether your
certain web application dosn't behave like this. Have you tried some other
simple web applcation deploying on that iis6 server to see whether the
problem also occurs? Also, if you can repro this with a simple web
project, you can attach it to us so that we can perform some tests on our
side.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top