I'm playing around with dependency injection in a web-forms website al a Ninject and whilst I have had no problem at all getting the site running smoothly I've had a pretty big problem when viewing individual pages using design mode.
I wouldn't normally use design mode but dragging and dropping web user controls onto a design space is the easiest way by far to add them to a page.
The set-up is pretty much identical to guidelines here The error on the design page is thus:
The type "page name" requests an injection, but no kernel has been registered for the web application. Please ensure that your project defines a Ninject开发者_开发技巧HttpApplication.
I'm using Asp.Net 4.0 with Ninject and Ninject.Web 2.2 utilizing property injection
This is pretty much a show stopper at the moment.
Cheers!
I can't believe it's been 6 days now without response.... Am I the only person experiencing this problem?
Well I had the same problem, with my ASP.NET Forms application (I guess I am also one of the last mohicans using ninject with this type op app ;-) ). My solution was to move method 'RequestActivation' inside PageBase and MasterPageBase (see Ninjects Web on git) from the OnInit page event to the constructor of the page...
Upon closer inspection the problem only occurred using property injection. A workaround was to get the value from a static instance of the applications Ninject Kernal from whatever class you set up to deal with IOC rather than use the Inject tag.
Upgrading to SP1 on Visual Studio 2010 though makes the problem go away entirely.
精彩评论