Error messages returned from Web API method are omitted in non-dev environment

后端 未结 5 2101
臣服心动
臣服心动 2020-12-29 22:21

I have a Web API controller POST method that behaves fine locally and on the testing server. If everything goes well it returns:

new HttpResponseMessage( Htt         


        
5条回答
  •  没有蜡笔的小新
    2020-12-29 22:50

    There have been many changes in the Web API code base since beta. Lots of awesomeness. See how to get nightly signed builds here.

    The generic HttpResponseMessage is no longer supported. Use HttpRequestMessage.CreateResponse. See this and this.

    You'll want to update to at least the current nightly build instead of using the beta if you're planning on sticking with it going forward. So many good improvements particularly for Web API.

    EDIT: In my mind, this was actually related to your original question because, while I haven't look into it for a concrete answer, it seems the newer stuff returns responses that don't get intercepted by IIS. It may have to do with the re-working of the error handling / error reporting.

    UPDATE 8/14/2012 The current Release Candidate for MVC 4 / Web API is good enough. You don't need to get the nightly build anymore unless you want to stay utterly up-to-date.

提交回复
热议问题