0

I just got this strange problem when I run locally and if I click on a link that takes me to controller X it works but after publishing it to windows azure I get this error when clicking the same link:

An error occurred when trying to create a controller of type 'Prodject.Controllers.ControllerX'. Make sure that the controller has a parameterless public constructor.

Same goes for all other links that takes me to that specific controller any ideas?

Not sure how much more info I can give since this is the only information I think I can get a hold off.

And no it's not an API controller

Thank you for reading my post and taking your time to help me out!

6
  • Are you using DI (dependency injection). Commented May 25, 2015 at 9:53
  • I'm a go with no sens i don't even know what that is :) Commented May 25, 2015 at 9:55
  • Try adding parameterless constructor to controller like public ControllerX(){ } Commented May 25, 2015 at 9:56
  • tried but to no avail :( Commented May 25, 2015 at 10:01
  • 1
    Please edit your question and add some code for class ControllerX Commented May 25, 2015 at 10:03

2 Answers 2

1

May be you have missed defining an parameterless contructor in some class(Used in the controller or the controller itself) where you have defined the contructor with parameter. And then try to instantiate the class without parameters.

Sign up to request clarification or add additional context in comments.

5 Comments

It is not mandatory to have parameterless constructor for class. It will get created automatically if it doesn't exists
I thought it does need can you please explain these stackoverflow.com/questions/7230544/…
Parameterless constructor will get created only when there is not constructor defined at all for that class. Parameterless constructor will not get automatically created if class has parametered constructor already defined in class.
Ok, I guess I was trying to explain same thing.
Also now I realized that he said that when he tries to click that link the error occurs. Which means it is a run time error. And if at all he was missing a parameterless constructor it would throw him compile time error. Therefore this is not the solution for this problem
0

Thanks to Rahul Nikate i found the problem there seems to have been an issue with the pathing for one of the classes constructors inside the controllerX, seams like Cijo V J was half right :)

1 Comment

You should at least up-vote that person's response then.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.