.NetCore WebApi接口 DELETE 请求错误405.0 - Method Not Allowed 跨域问题

.NET兼职社区

解决方案:

web.config中添加如下

csharp 复制代码
 <system.webServer>
      <modules runAllManagedModulesForAllRequests="true">
         <remove name="WebDAVModule" />
      </modules>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\Erp.Api.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
   </system.webServer>

只需要把WebDAVModule删除即可

csharp 复制代码
 <modules runAllManagedModulesForAllRequests="true">
         <remove name="WebDAVModule" />
      </modules>
相关推荐
海盗12349 天前
微软技术周报 ——2026-08-03
后端·python·microsoft·c#·.netcore
啊这啊这 六弦之首15 天前
.NET Core跨平台的奥秘[中篇]:复用之殇
.netcore
心念枕惊16 天前
.NET CORE 授权进阶-角色、策略与动态权限实现
java·前端·.netcore
完美火龙篇 四月的友17 天前
通俗易懂,什么是.NET?什么是.NET Framework?什么是.NET Core?
.net·.netcore
时代的狂1 个月前
如何理解 C# 的 async 和 await
c#·.netcore·async·await
尼米棕熊1 个月前
.NET CORE认证模块-注册方案与请求认证探究
.netcore
鸠摩智首席音效师2 个月前
如何在 macOS 上安装 .NET Core ?
macos·.netcore
宝桥南山2 个月前
Microsoft Agent Framework(MAF) - 如何将workflow或者A2A client转换成一个AI Agent
microsoft·ai·微软·aigc·.net·.netcore
滴滴答答哒3 个月前
.NET Core 基于 AOP + Polly 实现数据库死锁自动重试
数据库·.netcore·sqlsugar
.NET修仙日记3 个月前
.NET EFCore批量插入性能优化实战:30秒 → 0.5秒
性能优化·c#·.net·.netcore·微软技术·efcore·踩坑实录