469,950 Members | 1,391 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

Global class in a DLL


I have a DLL library containing some web services which are declared in
each .asmx file in the following way:

<%@ WebService Language="C#" Class="LibraryName.WebService" %>

I would like to log every unhandled exception that occurs on any web
service declared in the library to a file. I noticed the global class,
usually inside global.asax has the Application_Error event that can be
used for this.
However, I want to include the Global class in the library DLL, because
it is used for both IIS installations and with a Windows Service that
publishes the web services via soap.tcp connections.
How can I include this Global class in the library so that it is used in
both scenarios?
Thanks in advance for any help given.

Kind regards,
Oct 19 '06 #1
1 1515
Hello Paulo,

From your description, you want to use the "Global.asax" application_Error
event to capture unhandled exceptions for your webservices, and you also
want to compile the global.asax's codebehind class into the assembly
together with those webservcie classes, correct?

Based on my understanding, the Application_Error event is only used for
ASP.NET web page applications to capture unhandled exceptions. As for
webservice, it has different server-side processhandler and the
global.asax's Application_Error event won't work for webservice
applications. For ASP.NET webservice, you can use a custom SOAPExtension
to inspect any exception info from the SOAP message:

#User Friendly ASP.NET Exception Handling
However, I notice that you said the webservice will be used in a windows
service host also. Are you using some custom webservice hosting component
like WSE for the windows host application? for such component like
Global.asax for SoapExtension, they can only be used in ASP.NET
application host, other out of box host(windows service or winform ...) can
not use them.

BTW, since SOAP Extension can be configured at client side web service
proxy also, if you want to capture exception info at client-side, you can
consider write a SOAP Extension and use it for your webservice's client

#SoapExtension Class

Please feel free to let me know if there is anything I missed or if you
have any other consideration.


Steven Cheng

Microsoft MSDN Online Support Lead


Get notification to my posts through email? Please refer to

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at


This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 20 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

22 posts views Thread by fd123456 | last post: by
9 posts views Thread by tshad | last post: by
15 posts views Thread by randyr | last post: by
2 posts views Thread by Nathan Sokalski | last post: by
8 posts views Thread by Rob T | last post: by
15 posts views Thread by =?Utf-8?B?UGF0Qg==?= | last post: by
10 posts views Thread by ma | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.