在控制器上找不到公共操作方法ABC [英] A public action method ABC was not found on controller

查看:106
本文介绍了在控制器上找不到公共操作方法ABC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个控制器,我们在其中创建了以下两个动作:

Hi Everyone,

I''ve a controller within in which we have created following two actions:

public ActionResult DoSomething()
        {

            return View();
        }

[HttpPost]
public ActionResult DoSomething()
        {

            "do something and return Json result"
        }





现在的问题是,当链接指向DoSomething动作时,它会给我以下异常:



Now the problem is that while a link point to the DoSomething action it gives me following exception:

A public action method ''DoSomething'' was not found on controller





我已经四处寻找可能的原因了他们说大多数时候发生的论坛由于发出标题,所以添加动词:





I''ve looked around for possible reasons for this however, most of the forums they say that most of the times it happens due to emitting headers, so add the verb:

[acceptverbs(httpget | header)]





我尝试了(虽然我的代码没有发出任何类型的标题)。



如果有人可以指出我出于任何其他可能的原因,我将不胜感激。



我为此道歉忘了提到它只在我们在IIS上部署应用程序时才会发生,但是在本地Visual Studio开发服务器上它运行正常。



谢谢&问候

Pawan



Which I tried (though my code is not emitting any kind of header).

Would appreciated if someone could point me out on any other possible reasons.

My apologies as I forgot to mention that It happens only when we deploy the application on IIS, however on local Visual Studio development server it works fine.

Thanks & Regards
Pawan

推荐答案

最后我能够深入了解根本原因。非常令人惊讶的是,我们注意到虽然我们发布了整个应用程序,但由于某些未知原因,旧web.dll正在发布。在整个发布过程之后,我们必须手动将bin文件夹中的dll复制到已发布的站点。
finally I was able to drill down to the root cause. Very surprisingly we noticed that though we published the entire application, still due to certain unknown reasons the old web.dll was being published. We had to manually copy the dll from the bin folder to the published site after the entire publish process.


请参阅此主题中的答案:



http://stackoverflow.com/questions/1745182/intermittent-asp-net-mvc-exception-a-public-action-method-abc-could-not-be-fou [ ^ ]



看起来您必须修改网络的授权部分服务器中的.config。



希望这有帮助!
Refer to the answer in this thread:

http://stackoverflow.com/questions/1745182/intermittent-asp-net-mvc-exception-a-public-action-method-abc-could-not-be-fou[^]

Looks like you have to modify the authorization section of your web.config in the server.

Hope this helps!


这篇关于在控制器上找不到公共操作方法ABC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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