Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

I've a controller within in which we have created following two actions:
C#
public ActionResult DoSomething()
        {

            return View();
        }

[HttpPost]
public ActionResult DoSomething()
        {

            "do something and return Json result"
        }


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:

C#
[acceptverbs(httpget | header)]


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
Posted
Updated 19-Dec-12 0:36am
v2

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.
 
Share this answer
 
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!
 
Share this answer
 
Comments
Rai Pawan 19-Dec-12 23:30pm    
Thanks Kartik for your reply! However I've already tried it by adding the authorization section and denying the verbs OPTIONS, PROPFIND, HEAD, but It didn't work and keeps giving me same exception.

quite strange ;(
Karthik. A 19-Dec-12 23:57pm    
Sorry about that... Can you try using fiddler to see what requests are being issued ? That might tell you something. It gives you a lot of information like what type of request it is, whats the data posted and so on.
Rai Pawan 20-Dec-12 3:48am    
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.

Thanks for your reply.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900