问题描述
我目前正在使用serviceStack来创建基于REST的服务,这些服务托管在MVC Web应用程序中.
I am currently using serviceStack for creating REST based services which are hosted in a MVC web application.
到目前为止,ServiceStack令人赞叹,我已经实现了我想做的大部分工作.所有这些都可以在IISExpress中使用.
So far ServiceStack has been amazing and I have achieved to get most of what I wanted to do working. All this works in IISExpress.
我现在已移至IIS 7.5,并且在执行PUT时收到找不到请求处理程序"的400错误. GET可以正常工作,并且在IISExpress上,PUT和GET都可以工作.
I have now moved over to IIS 7.5 and I get the 400 error that the "Handler for Request not found" when doing a PUT. GET works fine and on IISExpress both PUT and GET work.
在IISExpress上,所有这些都起作用.
On IISExpress this all worked.
有什么想法吗?
推荐答案
有关IIS + PUT/DELETE动词的某些信息来自 NancyFx WebFx ASP.NET文档:
Some info about IIS + PUT/DELETE Verbs taken from the NancyFx WebFx ASP.NET documentation:
默认情况下,IIS 6不支持PUT和DELETE动词.为此,您需要将通配符映射添加到Nancy应用程序的虚拟目录中-阅读本文档中的"IIS6无需扩展的URL"部分: http://haacked.com/archive/2008/11/26/asp.net-mvc-on -iis-6-walkthrough.aspx
By default IIS 6 does not support PUT and DELETE verbs. To enable this, you need to add a wildcard mapping to the virtual directory of your Nancy application - read the "IIS6 Extension-less URLs" section in this document: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
尝试在IIS 7/7.5上进行PUT/DELETE请求时,您可能会收到"405不允许"页面.解决该问题的一种方法是在web.config中删除WebDAVModule.
You might receive "405 Not allowed" pages while trying to make PUT/DELETE requests on IIS 7/7.5. One way to fix it is to remove the WebDAVModule in the web.config.
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
</modules>
</system.webserver>
软件PUT/删除-模拟HTTP动词
ServiceStack还支持 X- Http-Method-Override HTTP标头,它将允许您使用POST模拟PUT或DELETE(反之亦然).
Soft PUT / DELETE - Emulating HTTP Verbs
ServiceStack also supports the X-Http-Method-Override HTTP Header which will allow you to simulate a PUT or DELETE with a POST (and vice-versa).
这篇关于在IIS7.5上找不到serviceStack的PUT处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!