删除在iis 10中不起作用的动词

删除在iis 10中不起作用的动词,iis,asp.net-web-api,cors,iis-10,http-delete,Iis,Asp.net Web Api,Cors,Iis 10,Http Delete,DELETE方法在IIS 10中显示以下错误 请求的资源上不存在“Access Control Allow Origin”标头 所有其他方法,如POST和GET,都可以正常工作。 在开发时,DELETE在iisexpress中工作良好。 我已经为WebApiConfig类中的所有请求启用了cors public static void Register(HttpConfiguration config) { config.SuppressDefaultHostAuthentication

DELETE方法在IIS 10中显示以下错误

请求的资源上不存在“Access Control Allow Origin”标头

所有其他方法,如POST和GET,都可以正常工作。 在开发时,DELETE在iisexpress中工作良好。 我已经为WebApiConfig类中的所有请求启用了cors

public static void Register(HttpConfiguration config)
{
    config.SuppressDefaultHostAuthentication();
    config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));

    // Web API routes
    config.MapHttpAttributeRoutes();
    var cors = new EnableCorsAttribute("*", "*", "*");
    config.EnableCors(cors);
    config.Routes.MapHttpRoute(
        name: "DefaultApi",
        routeTemplate: "api/{controller}/{action}/{id}",
        defaults: new { id = RouteParameter.Optional }
    );
我的网络配置看起来像这样

<?xml version="1.0" encoding="utf-8"?> <!--   For more information on how to configure your ASP.NET application, please visit   http://go.microsoft.com/fwlink/?LinkId=301879   --> <configuration>   <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />   </configSections>   <connectionStrings>
    <add name="Connection" connectionString="server=maclinkserver\mssql_dev;uid=sa;password=123;database=bisellsERP" />   </connectionStrings>   <appSettings></appSettings>   <system.web>
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" />
    <httpModules>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
    </httpModules>   </system.web>   <system.webServer>

    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
    <validation validateIntegratedModeConfiguration="false" />   </system.webServer>   <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>   </runtime>   <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>   </entityFramework>   <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers>   </system.codedom> </configuration>


但尚未解决。

默认情况下,IIS local中禁用了删除动词,您需要通过编辑

applicationhost.config



只需在启用的谓词列表中添加
DELETE

默认情况下,IIS local中禁用了
DELETE
谓词,您需要通过编辑

applicationhost.config



只需在启用的动词列表中添加
DELETE

我从其他地方找到了解决方案。 我刚从iis卸载了WEBDAV功能

跟着

控制面板->卸载程序->打开或关闭Windows功能 ->IIS->万维网服务->通用HTTP功能->WebDAV发布


我从别处找到了解决办法。 我刚从iis卸载了WEBDAV功能

跟着

控制面板->卸载程序->打开或关闭Windows功能 ->IIS->万维网服务->通用HTTP功能->WebDAV发布


Ipsit Gaur的回答有所帮助,但windows 2019上的卸载过程有所不同:

打开服务器管理器并选择“管理”、“删除角色和功能”,跳转到“服务器角色”部分并取消选中以下选项:

Web服务器(IIS)>Web服务器>通用HTTP功能>WebDAV发布

选择“下一步”,直到您可以在确认部分选择“删除”。您可能需要重新启动服务器才能使更改生效


以下是。

Ipsit Gaur的答案有帮助,但windows 2019上的卸载过程不同:

打开服务器管理器并选择“管理”、“删除角色和功能”,跳转到“服务器角色”部分并取消选中以下选项:

Web服务器(IIS)>Web服务器>通用HTTP功能>WebDAV发布

选择“下一步”,直到您可以在确认部分选择“删除”。您可能需要重新启动服务器才能使更改生效


以下是.

您能否在浏览器中检查响应标题中是否存在
访问控制允许原点
标题。浏览器第一次会发出选项飞行前请求,询问服务器允许使用源代码和方法。更多信息云计算尝试的另一件事是在API控制器上设置
[EnableCors(“*”、“*”、“*”)
属性,并使用
config.EnableCors()
only您可以在浏览器中检查响应标题中是否存在
Access Control Allow Origin
标题。浏览器第一次会发出选项飞行前请求,询问服务器允许使用源代码和方法。更多信息云计算尝试的另一件事是在API控制器上设置
[EnableCors(“*”、“*”、“*”)
属性,并使用
config.EnableCors()
onlyGaur如何访问applicationhost.config?很抱歉,我不是部署程序文件位于C:\Windows\System32\inetsrv\config,请以管理员身份运行记事本编辑我找到的文件。但是没有找到这样的
,我应该在哪个父节点中添加此Gaur如何访问applicationhost.config?很抱歉,我不是部署程序文件位于C:\Windows\System32\inetsrv\config,请以管理员身份运行记事本编辑我找到的文件。但是没有找到这样的
,我应该在哪个父节点中添加它
<add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />