我偶尔会碰到一个应用程序异常的WCF序列化过程中引发的(从我的OperationContract的返回DataContract后)的问题。唯一的(少meaningfull)消息我得到的是
I occasionally run into the problem that an application exception is thrown during the WCF-serialization (after returning a DataContract from my OperationContract). The only (and less meaningfull) message I get is
System.ServiceModel.CommunicationException :基础连接是 关闭:连接被关闭 出乎意料的。
System.ServiceModel.CommunicationException : The underlying connection was closed: The connection was closed unexpectedly.
没有任何了解的内部异常,这使得它真的很难找出序列化过程中造成的错误。
without any insight to the inner exception, which makes it really hard to find out what caused the error during serialization.
是否有人知道一个很好的方法,你如何跟踪,记录和调试这些异常?甚至更好,我可以捕获异常,处理它们并发送一个定义FaulMessage到客户端?
Does someone know a good way how you can trace, log and debug these exceptions? Or even better can I catch the exception, handle them and send a defined FaulMessage to the client?
谢谢
您应该如果配置这样您的服务行为得到内部异常:
You should get the inner exception if you configure your service behavior like this:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="YourServiceBehaviour">
...
<serviceDebug includeExceptionDetailInFaults="true" />
...
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
此外,您可以启用跟踪。没有找到好的文章了,但也许这可以让你开始:
Additionally you can enable tracing. Did not find a good article now, but maybe this gets you started:
http://developers.de/blogs/damir_dobric/archive/2009/03/24/using-of-wcf-trace.aspx
上一篇:如何到具体项目中的IEnumerable具体、项目、IEnumerable
下一篇:&QUOT;调用线程必须STA,因为许多UI组件都需要这个&QUOT;在创建线程中的WPF弹出窗口时出错线程、弹出窗口、组件、QUOT