技术开发 频道

如何利用WCF开启异常调试

IT168技术文档

    如何利用WCF开启异常调试?当你看到service发送的信息时怎样简便的调试异常?实现的方式就是向web.config文件中添加一段代码。之后你可以看到下面的配置段

<serviceDebug includeExceptionDetailInFaults="true" />

的详细功能。它将设置系统在返回的故障中,包括异常的详细资料。如果你完成此设置,确认以添加下列代码。你会发现异常信息将可以被用来找到你的服务器堆栈的使用方式。

<system.serviceModel> <services> <service name="OneCareStatus.LogUploadService" behaviorConfiguration="UploadServiceBehavior"> <endpoint address="" contract="OneCareStatus.ILogUploadService" binding="wsHttpBinding" bindingConfiguration="myHttpBinding"/> </service> <service name="OneCareStatus.FamilySafetyService" behaviorConfiguration="UploadServiceBehavior"> <endpoint address="" contract="WpcSettings.IWpcSettingsService" binding="wsHttpBinding" bindingConfiguration="myHttpBinding"/> </service> </services> <bindings> <wsHttpBinding> <binding name="myHttpBinding"> <security mode="None" /> <reliableSession enabled="true"/> </binding> </wsHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="UploadServiceBehavior"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel>



0
相关文章