How to return correct response on error in ASP.NET MVC 3.0 via JSON?

前端 未结 1 592
攒了一身酷
攒了一身酷 2021-02-08 13:05

I\'m struggling to resolve this problem. On my local machine (Win7/VS2010/IIS 7.5) and another identical developer\'s machine, the following code returns the 500 status code, an

相关标签:
1条回答
  • 2021-02-08 13:41

    Looks like IIS is eating the response and trying to do it's custom error stuff with it.

    Try setting

    Response.TrySkipIisCustomErrors = true
    

    in your catch.

    Alternatively set the following config value:

    <httpErrors errorMode="Custom" existingResponse="PassThrough"/>
    
    0 讨论(0)
提交回复
热议问题