Click here to Skip to main content
15,902,939 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I am working on visual studio 2013 and installed ninject.mvc5 and also
I have mapped like this

C#
private static void RegisterServices(IKernel kernel)
       {
           kernel.Bind<ITrainService>().To<TrainService>();
       }



But I am still getting error 'No parameterless constructor defined for this object.
I have also modified web.config like

XML
<dependentAssembly>
       <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
       <bindingRedirect oldVersion="1.0.0.0" newVersion="5.2.2.0" />

       <bindingRedirect oldVersion="2.0.0.0" newVersion="5.2.2.0" />

       <bindingRedirect oldVersion="3.0.0.0" newVersion="5.2.2.0" />
       <bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" />


     </dependentAssembly>

But still no luck
Any help ??
Posted
Comments
phil.o 22-Apr-15 14:41pm    
What object are you talking about? What is its type, and which line is concerned?

A parameterless constructor is required in a number of technologies, by a pretty apparent reason. Of course, there is a default constructor, but, if you define some other constructor(s), it will become available only if you explicitly define it. That's it. Define a parameterless constructor explicitly.

—SA
 
Share this answer
 
This problem is solved . Actually I had made area in another project. so I configured Ninject in parent project instead of doing it in child project.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900