WCF分布式開發常見錯誤解決(12):The server was unable to process the request,服務無法處理請求
進行WCF編程過程中會遇到這樣的錯誤:服務無法處理的請求由於內部錯誤。
具體信息如下:
The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.
錯誤截圖:
由於內部錯誤,無法處理請求。
解決辦法:
在服務行為裡配置錯誤屬性即可:
添加如下代碼到服務類:
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]