I know the error "No parameterless constructor defined for this object" has been asked about a million times. My situation is different
I have a working app. Many many controllers and one area with lots of controllers. I just added a new area. I added a controller and then a link to that controller. NOW I get the "No parameterless constructor defined for this object" error
I have seen and conquered this problem before but it really only happens like once every 5 months. And everytime I have totally forgotten ( repressed ) the answer.
Please help
Raif
Ok, so it seems that there are several reasons one might get this error. Not surprisingly none of them have @#$% all to do with not having a parameterless constructor. The two that I'm aware of are
1) if you are using an area and you, say, move a controller from one namespace to the new one and don't update the namespace to reflect the area you will get this error.
2) and this is my situation now, if you are injecting something into the constructor of the controller and the item you are injecting has a problem with it ( there are no instantiations, or it's not registered in your IOC registration or some other runtime error ) you will get this error.
If people can think of others they should list them here because I think there are several more causes for the error. R
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With