By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,786 Members | 2,241 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,786 IT Pros & Developers. It's quick & easy.

Global class in a DLL

P: n/a

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
Share this Question
Share on Google+
1 Reply

P: n/a
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.