WCF異常調試正確開啟方式詳解
作者:佚名
如果我們想在開發(fā)程序的過程中啟用WCF異常調試,應當如何正確的操作呢?下面就讓我們一起來看看正確的操作方法。
WCF開發(fā)工具中對于異常的處理是一個比較基本的操作步驟,在實際應用中,可以給我們的程序開發(fā)帶來非常大的好處。那么,WCF異常調試應該如何正確啟用呢?當你看到service發(fā)送的信息時怎樣簡便的調試異常?實現(xiàn)的方式就是向web.config文件中添加一段代碼。之后你可以看到下面的配置段
- < serviceDebug includeExceptionDetailInFaults="true" />
它將設置系統(tǒng)在返回的故障中,包括異常的詳細資料。如果你完成此設置,確認以添加下列代碼。你會發(fā)現(xiàn)異常信息將可以被用來找到你的服務器堆棧的WCF異常調試方式。
- < 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>
以上就是我們?yōu)榇蠹医榻B的WCF異常調試的相關啟用方式。
【編輯推薦】
責任編輯:曹凱
來源:
IT168