Finding the originating method in an exception

I have a program that i have developed.

Its is a WinForm app that consumes a .net web service.

This webservice then calls a business layer class, the business layer class then calls the DataAccess class to get the data for the app.

App --> WebService --> BizLayer --> DataLayer

There are 20 methods inside the web service

When an exception occurs in the DataLayer I want to be able to find out which web method originated the call.

Does anyone know of a way that from the catch block I can find out who was the originating method?

If web method C was the originator of the method chain, thats what I want to find out.

Thanks,

Nick

[718 byte] By [nick5454] at [2008-1-6]
# 1
You'll have to parse the text in the StackTrace property.
PeterRitchie at 2007-10-2 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2

no other layer class appears in the stack

i am using the StackTrace property and I have a try catch within the data access method. So I guess stack traces are created at the beginning of a try-catch block.

How can I access a global stack trace or tell the web service method to initiate a stack trace?

No other method is in the stack trace property

nick5454 at 2007-10-2 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 3
Where are you catching the exception? If it's in the app layer, no stack trace information on the server will make it back over the web service call.
PeterRitchie at 2007-10-2 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 4

The method originates in the web service method and the actual try catch is inside the DataAccess method.

The web services has a direct reference to my data access classes.

The actual try catch is inside the Data Access method. Inside the try catch method I want to somehow, maybe reflection, determine which web method called this function.

Does that make things clearer? Its a hard to describe

Application layer is not being used to get this information., nor will it see this data.

nick5454 at 2007-10-2 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 5
Check this thread.
nobugz at 2007-10-2 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 6
If you're able to modify the layer in question, see nobugz link on how to get extra information into the exception you're throwing.
PeterRitchie at 2007-10-2 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified