ninject / Ninject.Web.WebApi

Adds support for ASP.NET Web API to Ninject
Other
45 stars 37 forks source link

An error occurred when trying to create a controller of type... #16

Closed raphaelhudvoy closed 9 years ago

raphaelhudvoy commented 9 years ago

I installed Ninject Web API 3.2.4 (which is the current version on NuGet Manager) in a new Web API MVC 5 project. After adding and modifying the NinjectWebCommon.cs file in the App_start folder I tried to run some queries using postman. However I keep receiving this error:

screen shot 2015-03-17 at 20 30 42

When I downgrade to Ninject Web API 3.2.3, I don't get the error and everything works fine.

I looks like there are some breaking changes in the new version or is there a new way to configure Ninject Web API 3.2.4?

scott-xu commented 9 years ago

Please make sure you installed Ninject.Web.WebApi.WebHost

发自我的 iPhone

在 2015年3月18日,08:33,raphaelhudvoy notifications@github.com 写道:

I installed Ninject Web API 3.2.4 (which is the current version on NuGet Manager) in a new Web API MVC 5 project. After adding and modifying the NinjectWebCommon.cs file in the App_start folder I tried to run some queries using postman. However I keep receiving this error:

When I downgrade to Ninject Web API 3.2.3, I don't get the error and everything works fine.

I looks like there are some breaking changes in the new version or is there a new way to configure Ninject Web API 3.2.4?

— Reply to this email directly or view it on GitHub.

raphaelhudvoy commented 9 years ago

I added Ninject.Web.WebApi.WebHost and updated the new NinjectWebCommon.cs but I still have the same issue. Everything works fine if I downgrade again to 3.2.3

scott-xu commented 9 years ago

Can you zip a sample project and send to me?

发自我的 iPhone

在 2015年3月18日,20:56,raphaelhudvoy notifications@github.com 写道:

I added Ninject.Web.WebApi.WebHost and updated the new NinjectWebCommon.cs but I still have the same issue. Everything works fine if I downgrade again to 3.2.3

— Reply to this email directly or view it on GitHub.

raphaelhudvoy commented 9 years ago

Here it is: https://github.com/raphaelhudvoy/sampleWebAPIusingNinject/

Thanks

raphaelhudvoy commented 9 years ago

I think I mixup Ninject.Web.WebApi.WebHost and Ninject.Web.Common.WebHost. I uninstall all Ninject package and reinstall Ninject.Web.WebApi.WebHost with all its dependencies. It seems to work but now I am getting this error screen shot 2015-03-18 at 11 25 41

scott-xu commented 9 years ago

Please make sure all packages are up to date

raphaelhudvoy commented 9 years ago

When I run : Install-Package Ninject.Web.WebApi -Version 3.2.4

I get back the initial error!

raphaelhudvoy commented 9 years ago

I currently have those versions:

Ninject 3.2.2.0 Ninject.Web.Common 3.2.3 Ninject.Web.Common.WebHost 3.2.3 Ninject.Web.WebApi.WebHost 3.2.4 Ninject.Web.WebApi -Version 3.2.4

raphaelhudvoy commented 9 years ago

Finally I restarted from scratch following this: http://www.alexzaitzev.pro/2014/11/webapi2-owin-and-ninject.html. And everything works now!

scott-xu commented 9 years ago

You didn't install Ninject.Web.WebApi.WebHost