I have a controller class that takes care for the double click command and in turn calls a method that popups a window to the user. Something like :
var popup = container.GetService<PopupCommand>();
In the above line it throws an error saying : The current type, PopupCommand.IPopupDataHandler, is an interface and cannot be constructed. Are you missing a type mapping?
I updated the DLL that contained a method for container.GetService(), before that it used to work fine.
I tried searching in google, but the issues similar are more related to Unity, and i doubt whether my issue is anywhere related to Unity.
Basically the compiler tells you that you are trying to instantiate an interface.
container.GetService<PopupCommand>()
probably brings you back an interface namedPopupCommand.IPopupDataHandler
, you probably need to cast it to the type you need or change the type to an object, you should also check the constrains of the method - it could be missing thenew
constraint.Try Addin DefaultController Factory for Registering your controller. Three Steps :Step 1 1.Add a Class DefaultControllerFactory in your Project
Step 2:Register it in Bootstrap class in BuildUnityContainer Method
Step 3:And Register it in The Global.asax File
And finisihed. May be this will work for you... Happy Coding.