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