Turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server

前端 未结 6 1554
[愿得一人]
[愿得一人] 2020-11-27 10:12

I have a WCF service that has been working perfectly, and something has changed and I don\'t know what.

I get this exception:

System.ServiceMo

6条回答
  •  半阙折子戏
    2020-11-27 10:45

    You can also set it in the [ServiceBehavior] tag above your class declaration that inherits the interface

    [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
    public class MyClass:IMyService
    {
    ...
    }
    

    Immortal Blue is correct in not disclosing the exeption details to a publicly released version, but for testing purposes this is a handy tool. Always turn back off when releasing.

提交回复
热议问题