NancyFx / Nancy.Bootstrappers.Ninject

Nancy boostrapper for the Ninject container
MIT License
17 stars 25 forks source link

Fix: Method not found: 'Ninject.Syntax.IBindingToSyntax`1<System.Object> Ninject.Syntax.IBindingRoot.Bind(System.Type)'. #6

Closed ghost closed 12 years ago

ghost commented 12 years ago

runtime exception when trying to run application.

upgraded deps to latest version of Ninject.

shawty commented 12 years ago

I hope this is the right place to comment.

Iv'e pulled and built this and it resolves the issue ( as documented here on Stack overflow : http://stackoverflow.com/questions/11049691/conversion-of-v2-ninject-binding-to-v3/11051453#comment14496148_11051453 ) however upon running my program with the updated "Nancy.Bootstrappers.Ninject.dll" I now get the following thrown back at me:

{"Error activating IntPtr No matching bindings are available, and the type is not self-bindable. Activation path: 4) Injection of dependency IntPtr into parameter method of constructor of type Func{IRouteCache} 3) Injection of dependency Func{IRouteCache} into parameter routeCacheFactory of constructor of type DefaultRouteCacheProvider 2) Injection of dependency IDiagnosticsProvider into parameter diagnosticProviders of constructor of type DiagnosticsStartup 1) Request for IStartup

Suggestions: 1) Ensure that you have defined a binding for IntPtr. 2) If the binding was defined in a module, ensure that the module has been loaded into the kernel. 3) Ensure you have not accidentally created more than one kernel. 4) If you are using constructor arguments, ensure that the parameter name matches the constructors parameter name. 5) If you are using automatic module loading, ensure the search path and filters are correct. "}

Now this may be something I'm doing, I don't know enough about Nancy and/or Ninject to be sure, but I'm commenting here so that it's documented.

Cheers

Shawty

shawty commented 12 years ago

Ok so here's another update :

Following the advice here:

http://stackoverflow.com/questions/9693957/ninject-web-common-throwing-activationexception-trying-to-inject-dependencies-in

I added the following to my Kernel

kernel.Bind<Func>().ToMethod(ctx => () => new Nancy.Bootstrappers.Ninject.FactoryModule().Kernel);

and... i promptly got back the exact Exception that I received prior to applying the update documented in this Pull request.

Cheers

Shawty

thecodejunkie commented 12 years ago

I had a quick look at the code you sent me and it would not F5-run (it compiled, but never started the host). are you able to repo this in a much simpler application? Perhaps not using the WCF host either. Thanks!

shawty commented 12 years ago

Hi Andreas, I'll have a look tomorrow and see if I can, just about to go to bed now though :-)

it's most likely because the smart card code is attempting to find a USB card reader, not finding one and so therefore aborting, if you have any kind of smartcard usb reader plug it in, and see if it F5's, i'll see if I can strip that code out compleatley.

Cheers

Shawty

-----Original Message----- From: Andreas Håkansson [mailto:reply@reply.github.com] Sent: 26 July 2012 22:06 To: Peter Shaw Subject: Re: [Nancy.Bootstrappers.Ninject] Fix: Method not found: 'Ninject.Syntax.IBindingToSyntax`1 Ninject.Syntax.IBindingRoot.Bind(System.Type)'. (#6)

I had a quick look at the code you sent me and it would not F5-run (it compiled, but never started the host). are you able to repo this in a much simpler application? Perhaps not using the WCF host either. Thanks!


Reply to this email directly or view it on GitHub: https://github.com/NancyFx/Nancy.Bootstrappers.Ninject/pull/6#issuecomment-7290371