我通过iis 8.5在PHP上运行的angularjs应用程序出现“405 Method Not Allowed”错误
这是我的标题请求......
Access-Control-Allow-Headers:Content-Type, Accept
Access-Control-Allow-Methods:GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Origin:*
Allow:GET, HEAD, OPTIONS, TRACE
我能看到的是“允许:获取,头部,选项,追踪”中缺少帖子
任何人都可以指导我如何在IIS 8.5中启用POST请求。
解决
i finally solve this.... I guess the issue was in MY URL - api/login which is called in POST... i changes that URL with api/login/checklogin.php and executed POST request.... it works.......
SUPER THANKS TO LIN for his guidance and
http://stackoverflow.com always gives you the best.... THANKS ALL..
答案 0 :(得分:2)
CORS不会影响HTTP状态代码> HTTP状态代码影响cors 。从this回答,您应该允许IIS中的所有HTTP-Request类型 你需要。
您可以跟进this guide或在您的applicationhost.config
文件中进行以下更改:
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
还要确保从web.config
中删除了WebDAV模块(如果已安装并启用):
<system.webServer>
<modules>
<remove name="WebDAVModule"/>
</modules>
<handlers>
<remove name="WebDAV"/>
</handlers>
</system.webServer>