2013-11-21 152 views
0

我有一個運行IIS8.0的Azure雲應用程序。
我有一個Wordpress網站在上面運行,我想對某個資源發出POST請求。
當我使用REST控制檯時,它以200代碼成功。
當我使用iOS應用程序時,它返回一個405錯誤消息「Method POST is not allowed」。405錯誤IIS8.0 POST方法不允許

我檢查了請求標題,它們完全一樣。

我用Google搜索,我發現它可能是與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> 

任何人可以幫助我與我的問題?

回答

0

您可以嘗試使用像Wireshark這樣的網絡數據包偵聽器來查看iOS正在發送的原始HTTP。

1

我發現是什麼導致了這個問題。 我想知道爲什麼發送來自我的瀏覽器的請求是有效的,並從iOS應用程序不是。

瀏覽器和應用程序都發送完全相同的標題和有效負載和url。

該網址是這樣的:http://www.example.com/?json=subscribe/subscribe

原來應用程序無法使用此URL。我不得不使用:http://www.example.com/index.php?json=subscribe/subscribe

index.php必須添加爲iOS的工作。

我將Wordpress添加到關鍵字。