ninject - NinjectServiceHost in WCF service does not call Dispose() -


i've been trying dispose method on idisposable wcf service called whilst using ninject's ninjectservicehost without luck. i've downloaded ninject.extensions.wcf example code , tried idisposable timeservice's dispose() method called, not called either.

the service instantiated correctly, dispose() doesn't called.

is bug or myself , example code missing?

i've created stripped down service , testing host reproduces issue. code below.

i'm using ninject 3.0.1.10, ninject.extensions.wcf 3.0.0.5, .net 4.5

servicemodule.cs code (for setting bindings)

using ninject.modules;  namespace testninjectwcf {    public class servicemodule : ninjectmodule    {       public override void load()       {          bind<service1>().toself();           // i've tried bind<iservice1>().to<service1>()          // , tried various scopes such inparent() , inrequestscope()       }    } } 

console test program start service.

using system; using ninject.extensions.wcf; using ninject; using testninjectwcf;  namespace testconsole {    class program    {       static void main(string[] args)       {          var kernel = new standardkernel(new servicemodule());          var service = kernel.get<ninjectservicehost<service1>>();          service.open();          console.writeline("service started");          console.readkey();          service.close();       }    } } 

service implementation

using system; using system.diagnostics; using system.servicemodel;  namespace testninjectwcf {    [servicebehavior(instancecontextmode = instancecontextmode.single, concurrencymode = concurrencymode.multiple)]    public class service1 : iservice1, idisposable    {       public service1()       {          debug.writeline("constructor");       }        public string getdata(int value)       {          return string.format("you entered: {0}", value);       }        public void dispose()       {          debug.writeline("dispose");  // line never gets called!       }    } } 

maybe have created singleton service ? (instancecontextmode.single) 1 instancecontext object used incoming calls , not recycled subsequent calls. if service object not exist, 1 created


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -