0

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.

Can anyone help me on this please?

TechNo
  • 575
  • 2
  • 5
  • 24

1 Answers1

0

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

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.

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. Open in notepad the file: %windir%\system32\inetsrv\config\applicationhost.config
  2. In the ApplicationHost.config file, locate the <handlers> tag.
  3. Make sure that all the handlers use valid HTTP methods.
  4. Save the ApplicationHost.config file.
Roman Marusyk
  • 19,402
  • 24
  • 55
  • 90