I was trying to inject an asp.net 2.0 good old web service reference but it failed. the failure was when trying to use the injected interface.
this is my code where "CheapSecurityService" is a web service implementing "ISecurityService"
var lstItems = new List<IStoreItem>();
var kernel = new StandardKernel(
new InlineModule(
m => m.Bind<ILogger>().To<ConcreteLoger.ConcreteLoger>(),
m => m.Bind<ISecurityManager>().ToFactoryMethod(()=> new SecurityManager()),
m => m.Bind<ISecurityService>().ToFactoryMethod(() => new RemoteSecurityService.CheapSecurityService())
));
var oCalc = new Calculator();
oCalc.Logger = kernel.Get<ILogger>();
oCalc.SecurityManager = kernel.Get<ISecurityManager>();
oCalc.SecurityManager.SecurityService = kernel.Get<ISecurityService>();
when it gets to the last line I get the following error:
Ninject.Core.ActivationException was unhandled Message="Error activating ISecurityService: the FactoryMethodProvider returned an instance of type CheapSecurityService, which is not compatible with the requested service.\r\nUsing default binding from ISecurityService to CheapSecurityService (via FactoryMethodProvider)\r\n declared by Program.b_4()\r\nActivation path:\r\n 1) active request for ISecurityService\r\n from Program.Main()\r\n using default binding from ISecurityService to CheapSecurityService (via FactoryMethodProvider)\r\n declared by Program.b_4()\r\n" Source="Ninject.Core" StackTrace: at Ninject.Core.KernelBase.ResolveInstance(Type service, IContext context, Boolean isEagerActivation) in d:\Projects\Ninject\src\Core\KernelBase.cs:line 546 at Ninject.Core.KernelBase.GetT in d:\Projects\Ninject\src\Core\KernelBase.cs:line 221 at Console.Program.Main(String[] args) in D:\projects\Testing\UnitTesting\Console\Program.cs:line 32 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)