Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MVC2 ASP.NET4.0
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"
        }
 
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)]
 
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 19-Dec-12 1:31am
Rai Pawan2.4K
Edited 19-Dec-12 1:36am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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!
  Permalink  
Comments
Rai Pawan at 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 at 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 at 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.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 420
1 OriginalGriff 230
2 DamithSL 175
3 Dave Kreskowiak 120
4 Zoltán Zörgő 114
0 OriginalGriff 7,740
1 DamithSL 5,644
2 Sergey Alexandrovich Kryukov 5,404
3 Maciej Los 5,011
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 20 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100