Asp.NETCore 部署IIS配置了允许跨域但还是不支持 PUT , POST请求

允许跨域配置:

我配置的是允许指定域名,如果允许所有域名 使用 AllowAnyOrigin() 就可以了。

 

 

 

 

 

 

 

 

部署到IIS 后发现Get请求正常,Put请求 提示跨域

找到web.config文件增加

<remove name="WebDAVModule" />
<remove name="WebDAV" />
重新启动网址即可

 

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <configuration>
 3   <system.webServer>
 4     <modules runAllManagedModulesForAllRequests="true" runManagedModulesForWebDavRequests="true">
 5       <remove name="WebDAVModule" />
 6     </modules>
 7     <handlers>
 8       <remove name="WebDAV" />
 9       <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
10     </handlers>
11     <aspNetCore processPath="C:\Program Files\dotnet\dotnet.exe" arguments=".\TexHong_EMWX.Web.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00">
12       <environmentVariables />
13     </aspNetCore>
14     <httpProtocol>
15       <customHeaders>
16         <remove name="X-Powered-By" />
17       </customHeaders>
18     </httpProtocol>
19   </system.webServer>
20 </configuration>

 

posted @ 2020-09-09 09:10  Lyde  阅读(1585)  评论(0编辑  收藏  举报