jQuery success callback called with empty response when WCF method throws an Exception

前端 未结 5 1846
既然无缘
既然无缘 2021-02-05 11:55

I\'m tearing my hair out over this one, so bear with me (it\'s a long post).

Basic Info

  • ASP.NET 3.5 with WCF service in ASP.NET compatibility mode
5条回答
  •  天涯浪人
    2021-02-05 12:15

    I had a similar problem sort of with WCF and using ASP.NET compatibility as I integrate MVC and WCF in my solution. What I would do is throw a WebFaultException then check the Status of the response at the receiving end (either java or other .NET client). Your custom error could then throw that if the WebOperationContext.Current is not null. You are probably aware of this already but just thought I would throw it out there.

    throw new WebFaultException(HttpStatusCode.BadRequest);
    

提交回复
热议问题