HTTP 错误 405.0 - asp.net mvc 4 post 方法中不允许的方法错误

HTTP Error 405.0 - Method not allowed error in asp.net mvc 4 post method

我有一个现有的 asp.net mvc 4 解决方案。它在不同的文件夹中有几个 controllers/models/views 并且一切正常 使用 GET 和 POST 控制器方法。我添加了一个新文件夹并添加了它自己的 controllers/models/views。 当我调用 GET 控制器方法时,从视图来看它工作正常。但是 POST 控制器方法 投掷

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

下面是我的view和controller

<div id="usercreds" class="items">
   @using (Html.BeginForm("SaveCustomer", "NewCustomer"))
   {
        //form control code here               
   }

   [HttpPost]
   public ActionResult SaveCustomer(NewCustomerModel newCustomer)
   {
        //more code here
   }

我在Html.BeginForm方法中添加了FormMethod.Post,在web.config文件中添加了modules="IsapiModule"

我仍然遇到同样的错误。

问题是 VisualStudio 解决方案中有两个同名文件夹。因此,它发布到错误的 URL。我重命名了其中一个文件夹,它工作正常。