5

I am trying to call an Action from my view using @Html.Action("ActionName","controllerName"). But my page fails to load with below error:

A single instance of controller 'Web.Areas.Area1.Controllers.ActionController' cannot be used to handle multiple requests. If a custom controller factory is in use, make sure that it creates a new instance of the controller for each request.

I am using structure map for Dependency injection. Please help me what am i missing.

1 Answer 1

6

You need to add

x.For<{Your controller name}>().AlwaysUnique();

in IoC.cs file. This should be done for every controller in your project.

For more details check this link.

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

Comments

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.