如何处理SharePoint异常? [英] How do I handle SharePoint exceptions?
问题描述
我是SharePoint的新手,所以我想如何处理异常?当我编写自定义代码时,我必须检查它们,或者也许,如果它们被抛出,他们会自动记录并且不会破坏应用程序?
I`m new to SharePoint, so I guess how do I need to handle exceptions? When I write custom code do I have to check for them or maybe, if they are thrown, they automatically get logged and don't break the app?
如果没有,那么如何登录?
If not, then how do I log them?
谢谢!
编辑:我应该如何记录这些例外?
And how should I log those exceptions?
推荐答案
使用此命令写入日志: http://msdn.microsoft.com/en-us/library/aa979522.aspx
Use this to write to the log: http://msdn.microsoft.com/en-us/library/aa979522.aspx
除非您处理您的异常,否则应用程序将很可能会中断。某些错误,例如在事件接收器中生成的错误,不会中断应用程序(终止事件接收器除外)。除了您更改中央管理员的设置之外,其他所有其他未捕获的错误都将记录在日志中。
Unless you handle your exceptions the application will most likely break. Some errors such as those generated in event receivers will not "break" the application (except for terminating the event receiver). Those, along with all other uncatched errors will end up in the log unless you've changed the settings in central admin.
这篇关于如何处理SharePoint异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!