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 6371139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:01:24+00:00 2026-05-25T01:01:24+00:00

I’m using Ninject 2.2 with the WCF extension. On most of my services the

  • 0

I’m using Ninject 2.2 with the WCF extension. On most of my services the repositories are instantiated/released quickly. However, one of my services performs long-running operations (2-3 min). If I watch the w3wp process I can see the TCP/IP connections being established with SQL and I can run sp_who2 on SQL and see the connections.

When these operations are complete, the connections remain open for 5-10 minutes.

I don’t see new connections being spawned when I run the operation multiple times but I will have multiple instances of the app running and I saw a performance degradation previously while spamming those long running operations and it fixed itself after several minutes.

Could this garbage collection be part of the problem and how can it be addressed?

Here is my Ninject binding:

Bind<ISomeRepository>().To<SomeRepository>().InRequestScope();

Here is my WCF binding:

<binding name="xxx" closeTimeout="00:01:00"
  openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
  bypassProxyOnLocal="false" transactionFlow="false" 
  hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" 
  maxReceivedMessageSize="99999999" messageEncoding="Text"
  textEncoding="utf-8" useDefaultWebProxy="false" allowCookies="false">
  <readerQuotas maxDepth="90" maxStringContentLength="99999" 
    maxArrayLength="99999999" maxBytesPerRead="4096" 
    maxNameTableCharCount="16384" />
  <reliableSession ordered="true" inactivityTimeout="00:10:00"
    enabled="true" />
  <security mode="..."/>
</binding>

<service name="SomeService" 
  behaviorConfiguration="abcd">
  <endpoint name="BasicEndPoint" address="http://localhost/SomeService.svc" 
    binding="wsHttpBinding" bindingConfiguration="xxx"
    contract="ISomeJobService"/>
  <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>

I realize one option is to reduce the number of repositories in use by the service down to one but I’m really looking for an interim solution.

  • 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-05-25T01:01:24+00:00Added an answer on May 25, 2026 at 1:01 am

    InRequestScope has no function in WCF unless you are hosting in IIS compatibility mode. That is not the default mode, nor is it recommended for most purposes.

    What will actually happen when you try this is that Ninject will use a null scope, which is equivalent to not specifying any scope at all. That in turn results in the standard cache and collect behaviour, which means Ninject will dispose of those connections (thus releasing them back into the connection pool) whenever it feels like it, to state it in very simplistic terms.

    The closest analog to this in WCF is the OperationScope. You can bind using

    Bind(...).To(...).InScope(() => OperationContext.Current)
    

    This used to be a half-baked solution but I think it should work properly now, because the NinjectServiceHostFactory adds a service behaviour which automatically notifies the cache when the “request” (that is, the operation) is over.

    This support was added to the official extension very recently, I think as recently as March ’11, so make sure you’re using the latest. At the time of writing, that’s 2.3.0.0.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I am reading a book about Javascript and jQuery and using one of the
I am using JSon response to parse title,date content and thumbnail images and place
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build

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.