Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7923679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:24:00+00:00 2026-06-03T17:24:00+00:00

Here is my module internal class WebServiceConfiguration : NinjectModule { public override void Load()

  • 0

Here is my module

internal class WebServiceConfiguration : NinjectModule
{
    public override void Load()
    {
        Bind<IWebService>().To<WebService>().InRequestScope();
    }
}

Here is the global.asax

public class Global : NinjectHttpApplication
{
    protected override IKernel CreateKernel()
    {
        return new StandardKernel(new WebServiceConfiguration());
    }
}

I also tried InScope(c => OperationContext.Current)

Here is my service with IDisposable in IWebService

[ServiceBehavior(InstanceContextMode = InstanceContextModeDefinition.Mode)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class WebService : IWebService
{
    private readonly ISomeService _someService;

    public WebService(ISomeService someService)
    {
        _someService = someService;
    }

    public void Dispose()
    {
        _someService.Dispose();
    }

Here is the ServiceHostFactory in the service markup

<%@ ServiceHost Language="C#" Debug="true" Factory="Ninject.Extensions.Wcf.NinjectDataServiceHostFactory" Service="WCFTest.Services.WebService" CodeBehind="WebService.svc.cs" %>

The injection of dependencies works. My only concern is that the dispose method is not being triggered when the Client closes the service call.

I tried to remove the Factory=”Ninject.Extensions.Wcf.NinjectDataServiceHostFactory” just to test if the Dipose will be called, and it did call but of course i won’t have auto injection. So there might be something i’m doing wrong in the setup? or there is a bug on ninject not calling Dispose?

Note: I grab the sample setup in ninject wcf extension and just added some DI.

Your help will be appreciated.

BTW: I’m using Ninject 3.0.0.15, Ninject.Extensions.Wcf 3.0.0.5, Ninject.Web.Common 3.0.0.7

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T17:24:01+00:00Added an answer on June 3, 2026 at 5:24 pm

    Use

    Bind<IWebService, WebService>().To<WebService>().InRequestScope();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a program in Haskell here it is the code module Main
I'm testing distributing a Python extension module as an egg created with setuptools. Here
This is something similar to what's posted here: No Module named django.core To reiterate,
Im working on a large multi-module project which uses an internal framework as one
How can I open __init__.pyc here? >>> import stompservice <module 'stompservice' from 'C:\Python25\lib\site-packages\stompservice-0.1.0-py2.5.egg\stompservice\__init__.pyc'> All
I've been asked about the possibilities for writing an ejabber module for an internal
The code below successfully recognizes internal classes which are decorated with my custom Module
here is the sql codes SELECT roles.role_id, usertype_module.role_id, usertype_module.viewable, usertype_module.editable, usertype_module.createable, modules.modules_id, usertype_module.modules_id, modules.modules,
I am here as a developer of a website. My website got different modules
Here's my proposed (very simplified to illustrate the problem space) design for a C#

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.