HTTP错误405.0 - 方法,ASP.net MVC5不允许 [英] HTTP Error 405.0 - Method Not Allowed in ASP.net MVC5

查看:2316
本文介绍了HTTP错误405.0 - 方法,ASP.net MVC5不允许的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不断收到以下消息,同时运行我的应用程序。

I am continuously getting the following message while running my application.

HTTP Error 405.0 - Method Not Allowed
The page you are looking for cannot be displayed because an invalid method     (HTTP verb) is being used.

我没有任何线索如何发生这种情况。

I dont have any clue how this happening.

我试图用最后撤消的变化,但仍是其无法正常工作。

I tried to run this with undoing last changes but still its not working.

谁能帮我这个好吗?

推荐答案

主要是它意味着你的Web服务器不能识别的HTTP方法( GET,POST,DELETE,PUT ...)中的要求。

Mostly it means that your Web Server is not recognizing the HTTP method(GET,POST,DELETE,PUT ...) in the request.

首先,检查在行动由defult运行RouteConfig.cs文件。

First, check in the RouteConfig.cs file which action run by defult.

routes.MapRoute(name: "Default",
   url: "{controller}/{action}/{id}",
   defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);

在这种情况下,我们从被默认设置首页的控制器操作指标。

In this case we have action Index from Home controller that was set by default.

然后,检查行动。是否有任何属性,如: [HttpPost] [HttpDelete] [HttpPut] ,...
结果
如果你使用的属性,那么你可能需要在ApplicationHost.config文件中的微小变化来启用它:

Then, check that action. Is there any attributes like: [HttpPost], [HttpDelete], [HttpPut], ...
If you use attribute then you maybe need to make small changes in ApplicationHost.config file to enable it:


  1. 开启记事本文件:%WINDIR%\\ SYSTEM32 \\ INETSRV \\设置\\对ApplicationHost.config

  2. 在ApplicationHost.config文件中找到<处理器>标签

  3. 确保所有处理程序使用有效的HTTP方法。

  4. 保存ApplicationHost.config文件。

这篇关于HTTP错误405.0 - 方法,ASP.net MVC5不允许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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