简体   繁体   English

无法从我的课程库捕获异常

[英]Can't catch exceptions from my class library

I have made a class library in .NET 3.5. 我在.NET 3.5中创建了一个类库。 My goal is to use it in existing webservices made with .NET 2.0. 我的目标是在使用.NET 2.0的现有Web服务中使用它。

I have a lot of exception handling in the webservice project but if an exception occurs in my classlibrary my handlers doesn't catch them and the calling method just exits! 我在webservice项目中有很多异常处理,但是如果我的类库中发生异常,我的处理程序将无法捕获它们,并且调用方法只会退出!

When in "white coat" environment (read visual studio - debugging) there is no problem. 在“白大褂”环境中(阅读Visual Studio-调试)时,没有问题。 But in my production environment - BOOM! 但是在我的生产环境中-BOOM!

Go into the Application and System event logs on the production box. 进入生产框上的“应用程序和系统”事件日志。 You should see some errors there. 您应该在那里看到一些错误。 Do they help diagnose the problem? 他们是否有助于诊断问题?

Are you saying that you've wrapped the offending code in a TRY-CATCH block, and in the VS debugger it catches the exception as it should, but in the wild, it does not appear to catch the exception? 您是说您已经将有问题的代码包装在TRY-CATCH块中,并且在VS调试器中它会按应有的方式捕获异常,但是在野外却似乎没有捕获到异常? Is it possible that it is catching it, but it's just handling it and not letting you know as you expect it to? 它是否有可能被捕获,但只是在处理它而没有按您期望的那样告知您?

What's in the CATCH block that would notify you that an exception has occurred - logging of some type? CATCH块中有什么通知您发生了异常-某种类型的日志记录?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM