How to get exception information when calling JSON web service

后端 未结 2 1625
野的像风
野的像风 2021-01-21 00:09

In .NET 3.5, I had the following code:

[WebService(Namespace = \"http://kitchenpc.com/schemas/\")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
         


        
2条回答
  •  醉梦人生
    2021-01-21 01:03

    Ah, this was a stupid issue. The exception information only appears if you have:

    
    

    In your web.config (under ). I'm actually not sure if this is a .NET 3.5 -> .NET 4.5 change in behavior, or if it got broke when I was re-writing my web.config build process using web.config transforms.

    Does anyone know if there's a way to control this on a per web-service level? I'd rather not show full debug info on normal page requests.

    Update:

    I also came to the conclusion that throwing exceptions to communicate error information from a web service is really not a good design. In fact, I wrote a post on the subject on my blog for those interested.

提交回复
热议问题