[英]405 error IIS8.0 POST method not allowed
I have an Azure cloud app running IIS8.0. 我有一个运行IIS8.0的Azure云应用程序。
I have a Wordpress site running on it and I want to make a POST request to a certain resource. 我有一个Wordpress网站正在运行,并且我想对某个资源发出POST请求。
When I use a REST console it succeeds with 200 code. 当我使用REST控制台时,它会成功显示200个代码。
When I use a iOS app it returns an 405 error with the message "Method POST is not allowed". 当我使用iOS应用程序时,它返回405错误,并显示消息“不允许方法POST”。
I checked the request headers and they are exactly the same. 我检查了请求标头,它们完全相同。
I googled and I found out it may have something to do with the handlers in IIS, therefor here are my handlers: 我搜索了一下,发现它可能与IIS中的处理程序有关,因此这里是我的处理程序:
<handlers accessPolicy="Read, Script">
<add name="PHP54_via_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.4\php-cgi.exe" resourceType="Either" />
<add name="PHP53_via_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.3\php-cgi.exe" resourceType="Either" />
<add name="CGI-exe" path="*.exe" verb="*" modules="CgiModule" resourceType="File" requireAccess="Execute" allowPathInfo="true" />
<add name="TRACEVerbHandler" path="*" verb="TRACE" modules="ProtocolSupportModule" requireAccess="None" />
<add name="OPTIONSVerbHandler" path="*" verb="OPTIONS" modules="ProtocolSupportModule" requireAccess="None" />
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
</handlers>
Can anybody help me with my issue? 有人可以帮我解决我的问题吗?
I found out what was causing the issue. 我发现了导致问题的原因。 I was wondering why sending a request from my browser was valid and from the iOS app was not.
我想知道为什么从浏览器发送请求是有效的,而从iOS应用程序发送请求却无效。
Both the browser and the app were sending exactly the same headers and payload and url. 浏览器和应用程序都发送完全相同的标头,有效负载和url。
The url was something like this: http://www.example.com/?json=subscribe/subscribe . 网址是这样的: http : //www.example.com/ ?json=subscribe/ subscribe 。
Turns out the app wasn't able to use this URL. 原来该应用无法使用此URL。 I had to use: http://www.example.com/index.php?json=subscribe/subscribe
我必须使用: http : //www.example.com/index.php?json=subscribe/subscribe
The index.php
had to be added for iOS to work. 必须添加
index.php
才能使iOS正常工作。
I'm adding Wordpress to the keywords. 我将Wordpress添加到关键字中。
您可以尝试使用Wireshark之类的网络数据包侦听器查看iOS发送的原始HTTP。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.