System.MissingMethodException: No parameterless constructor defined for this object. What a great error message right? If you are using ASP.NET MVC, You may be fooled into thinking that receiving this message always means that you need to add something to your controllers. It doesn't! That's right - I said it doesn't always mean that. This message, which is about as helpful as a porcupine in your bathtub, can often point to an issue with the routes in your application.
Instead of going through a lengthy explanation about this error, I'm just going to get to the point. This error can be caused by having an incorrect route defined in your global.asax file. To troubleshoot this error, check your global.asax file and make sure that any parameter that is not a required parameter has the UrlParameter.Optional item. For example, id = UrlParameter.Optional. This error can occur if you have a route defined without an action and then you send in an url WITH the action. Making the action equal to UrlParameter.Optional can, in some instances, solve the problem.
Smooches,
Kila
This blog is for all Microsoft & .net lovers who may find themselves in need of help or information once in a while. We all have questions and we all need to know more than we know right now. When I come across things that I think may be useful, I post it. When I have something to say that I think is important, which is everything, I post it. All of my C#, ASP.NET, VB, AJAX & programming friends around the world are welcome to the info in my blog - Ramblings Of A Crazy DotNet Woman!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment