views:

190

answers:

4

Hi I found out that my application causes some errors which are logged in an Event log.

It states:

NET Runtime 2.0 Error 

    EventType clr20r3, P1 *****.exe, P2 1.0.0.0, P3 4b2a572f, P4 system.web.services, P5 2.0.0.0, P6 4889df18, P7 bc, P8 65, P9 system.net.webexception, P10 NIL.

How can I find out what's going on? I've tried that app locally and everything works fine.

+1  A: 

Can you describe more about the type of application it is? What it's doing, is it interactive or non-interactive?

The actual error is system.net.webexception - which is some form of problem communicating with a web-page or web-service. This in itself suggests it might an intermittent error if it works fine when you try it.

Either that or something is misconfigured when it's running remotely - something different to your environment. For example, do you use an internal DNS entry that's not available when the application is run remotely?

You will want to catch all exceptions in your application (like an overall try { } catch { } in your main method) and log the exceptions to a file, or get it to e-mail them to yourself, so you can see in more detail what's occuring.

Andy Shellam
Yep.. it's an application the connects to server 1, gets an XML file.. then connects to a MS reporting service getting some reports and finally connects to server 3 where it sends some generated files
PaN1C_Showt1Me
Could it be that the reports it's fetching are taking longer than the web-service client will wait for, and is timing out?
Andy Shellam
Yep it could be the reason.. but I don't understand it.. as I've got this piece of code in try catch clause
PaN1C_Showt1Me
In that case it's not that piece of code causing the exception - unless you're rethrowing it. Surround the contents of your `main` method in a try/catch, and handle the exceptions in a more useful way - such as writing the stacktrace to a file on the machine.
Andy Shellam
Ah you mean to surround the whole code with try catch.. I suppose you mean just for debugging purposes.. (otherwise it would be a try catch project :D )
PaN1C_Showt1Me
BTW I'm using System.Diagnostics.Trace to write all caught Exceptions in a file
PaN1C_Showt1Me
Not just for debugging purposes, you should always handle all exceptions - even if it's just writing it to a file and exiting. An unhandled exception crashes the application - not a good experience for user or developer as you're finding out now ;-)
Andy Shellam
Yeah i know.. but I mean the try catch should be placed at the location where it is really needed otherwise performance issues arise.. OK i'll try to surround the whole code just to find out where it really happens. Thanks
PaN1C_Showt1Me
FYI there's no performance penalty whether you have try/catches all over the place, or just one in your `main` method. The performance penalty comes when the exception is actually thrown - if you're routinely relying on exceptions to handle things like formatting errors, that's when you start getting performance penalties.
Andy Shellam
+1  A: 

It looks like an unhandled exception. If it's being generated in an web application or service you can try putting an global exception handler in your global.asax file. See here for an example. You can trap the error and output some better information to the event log.

TLiebe
As far as I can tell from the error log, it's a .exe, therefore a Windows application, not a web application.
Andy Shellam
The problem is that the application is a console application being started by the system scheduler
PaN1C_Showt1Me
@Andy.. correct Andy.. its an .exe residing directly on the machine
PaN1C_Showt1Me
If it's a web exception being generated in a Windows application then you should be able to wrap the call to the web method with a Try..Catch block and write the details of the exception to the event log or a log file.
TLiebe
Not sure why I got the -1. .NET runtime errors can occur in w3wp.exe, the IIS worker process, when an unhandled exception occurs in a ASPX application.For example, one that I've taken from the Application event log on one of my web servers:EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.3959, P3 45d6968e, P4 rtbase, P5 1.0.0.0, P6 4909e67b, P7 61, P8 321, P9 pe.pexception, P10 NIL.
TLiebe
+1  A: 

Your app crashed on an unhandled exception. The Watson log won't be good enough to find the cause. Write an event handler for the AppDomain.CurrentDomain.UnhandledException event, have it write e.ExceptionObject.ToString() to the event log so you'll get a good stack trace that shows you why and where it bombed.

Hans Passant
A: 

Here is the simple explanation from your event log entry

P4 system.web.services -  module that was throwing the exception 
P9 system.net.webexception  - Exception Type
P8 65 - IL Offset where the exception was thrown

These are Watson bucket for getting the call-stack of the exception. From .NET 2.0 onwards Watson reports have this information.

Here is the MSDN article for above explanation.

Naveen