【问题标题】:Web Api GET Verb 405 Not AllowedWeb Api GET 动词 405 不允许
【发布时间】:2017-03-22 04:55:17
【问题描述】:

我有与大多数人相反的问题。我失败的动词是 GET 和 POST。出于某种原因,允许 PUT 和 DELETE。这是我的相关 web.config。

  <system.webServer>
<handlers>
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
<rewrite>
  <rules>
    <rule name="static dist files" stopProcessing="true">
      <match url="^(.+)$" />
      <conditions>
        <add input="C:\Source\PRISM\DEV\PRISM\Service\PRISM.Service\dist\{R:1}" matchType="IsFile" />
      </conditions>
      <action type="Rewrite" url="/dist/{R:1}" />
    </rule>
    <rule name="index.html as document root" stopProcessing="true">
      <match url="^$" />
      <action type="Rewrite" url="/dist/index.html" />
    </rule>
  </rules>
</rewrite>

【问题讨论】:

  • 我也试过添加 remove name="WebDAV" 但什么也没做。
  • 你是在本地运行它还是失败了?

标签: asp.net-web-api http-status-code-405 httpverbs


【解决方案1】:

所以这不是错误 405 问题。我有一个与我的路由不匹配的方法签名,特别是参数 id。我的 get 方法有一个不同的参数名称。

【讨论】:

  • 如果是这种情况,您应该删除您的问题,因为它并没有真正为网站提供价值。
猜你喜欢
  • 2013-03-21
  • 1970-01-01
  • 2018-02-04
  • 2016-03-23
  • 1970-01-01
  • 2018-05-27
  • 1970-01-01
  • 2017-11-13
  • 2014-06-11
相关资源
最近更新 更多