Laravel 5.5错误405(不允许使用方法)XHR PUT方法现在可以在Azure服务器上使用 [英] Laravel 5.5 Error 405 (Method Not Allowed) XHR PUT METHOD now working on Azure Server

查看:39
本文介绍了Laravel 5.5错误405(不允许使用方法)XHR PUT方法现在可以在Azure服务器上使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在装有PHP 7的Azure Web服务器上安装了Laravel 5.5.除XHR PUT METHOD之外,其他请求方法也能正常工作.它在控制台上返回错误消息: 405(不允许使用方法)和XHR网络预览:由于使用了无效的方法(HTTP动词),因此无法显示正在查找的页面

I have installed Laravel 5.5 on Azure Web Server with PHP 7 installed. Other request methods working well except the XHR PUT METHOD. It returns an error message on the console: 405 (Method Not Allowed) and XHR network preview: The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.

我已经允许在 web.config 文件上使用 PUT方法

I already allowed the PUT method on web.config files

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
 <system.webServer>
 <urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/>
 <staticContent>
 <remove fileExtension=".svg" />
 <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
 <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
 <clientCache httpExpires="Sun, 29 Mar 2020 00:00:00 GMT" cacheControlMode="UseExpires" />
 </staticContent>
 <httpProtocol>
 <customHeaders>
 <add name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains"/>
 <add name="Access-Control-Allow-Origin" value="*" />
 <add name="Access-Control-Allow-Headers" value="X-Requested-With,Content-Type" />
 <add name="Access-Control-Allow-Methods" value="POST,GET,OPTIONS,DELETE,PUT,PATCH" />
 </customHeaders>
 </httpProtocol>
 <rewrite>
 <rules>
 <rule name="Laravel5" stopProcessing="true">
 <match url="^" ignoreCase="false" />
 <conditions logicalGrouping="MatchAll">
 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
 <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
 </conditions>
 <action type="Rewrite" url="index.php" appendQueryString="true" />
 </rule>
 </rules>
 </rewrite>
 <security>
      <requestFiltering>
        <requestLimits maxQueryString="10000" />
      </requestFiltering>
    </security>
 </system.webServer>
</configuration>

请帮助我.谢谢

推荐答案

通过这个问题,我找到了答案.通过将此代码添加到 system.Webserver

I have found the answer, by this question. stackoverflow.com/a/25171782/2544756 by adding this code to system.Webserver

<handlers>
    <remove name="PHP71_via_FastCGI" />
    <add name="PHP71_via_FastCGI" path="*.php" verb="GET,PUT,POST,DELETE,HEAD,OPTIONS,TRACE,PROPFIND,PROPPATCH,MKCOL,COPY,MOVE,LOCK,UNLOCK" modules="FastCgiModule" scriptProcessor="D:\Program Files (x86)\PHP\v7.1\php-cgi.exe" resourceType="Either" requireAccess="Script" />
</handlers>

但是我需要将PHP版本更改为7.1希望它

But I need to change the PHP version to 7.1 Hope it

这篇关于Laravel 5.5错误405(不允许使用方法)XHR PUT方法现在可以在Azure服务器上使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆