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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:46:02+00:00 2026-06-10T21:46:02+00:00

I am starting to develop the following scenario (Visual Studio 2010, WCF): Different clients

  • 0

I am starting to develop the following scenario (Visual Studio 2010, WCF): Different clients in our network will call a web service that I developed myself, which is hosted as part of a windows service, so we are talking about a self hosted WCF Web Service inside a Windows Service.

That self hosted WCF Web Service will in turn make calls to an external Web Service, so is acting like a sort of facade.

Obviously my self hosted WCF Web Service will need to accept concurrent calls and here comes my question: What I am planning to is in the operations that are called from the different clients on my self hosted WCF Web Service, I would simply create the client for the external webservice, make the call to the external webservice, get a syncronous response back from the external web service and then reply to the calling client.

Sounds simple, but is there anything I need to consider about multiple threads entering my service host? Obviously I need to be careful with any “global” variables in the host itself, but I should be save if I simply create the external web service clients in the different operations of the called web service, or have I overlooked something?

Thanks all!

Cheers,
Stevo

  • 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-10T21:46:04+00:00Added an answer on June 10, 2026 at 9:46 pm

    You have a few choices here, particularly as they relate to WCF instancing and Concurrency.

    Instancing: Your choices here are

    • PerCall: A new InstanceContext (and therefore service object) is created for each client request.
    • PerSession: A new InstanceContext (and therefore service object) is created for each new client session and maintained for the lifetime of that session (this requires a binding that supports sessions).
    • Single: A single InstanceContext (and therefore service object) handles all client requests for the lifetime of the application.

    Concurrency:

    • Single: Each instance context is allowed to have a maximum of one thread processing messages in the instance context at a time. Other threads wishing to use the same instance context must block until the original thread exits the instance context
    • Multiple: Each service instance can have multiple threads processing messages concurrently. The service implementation must be thread-safe to use this concurrency mode.
    • Reentrant: Each service instance processes one message at a time, but accepts re-entrant operation calls. The service only accepts these calls when it is calling out through a WCF client object.

    Lets look at Instancing first:

    Per Call: Basically here what happens is if two clients make a call to your service, 2 different instances of your service are created, and then destroyed once the call is complete

    Per Session: If those two clients make 2 calls each via your proxy, the wcf instance created on your host for both of those calls will be the same (for each proxy so 2 instances serving 2 each but each caller goes to the same instance), and then destroyed

    Single: Both proxies/clients will use the same instance, so caller 1 invokes an operation, and then caller 2 makes a call, this same instance will be reused.

    Pretty straight forward.

    As far as concurrency goes, its the number of threads active in the above mentioned instance context at one time. Here i side with experience and MSDN, which states that “understanding and developing code that safely uses more than one thread can be difficult to write” (but not impossible)

    So based on your requirements it seems you don’t want to maintain state and scalability could be concern since you are servicing multiple proxy calls and you don’t need to share any kind of global data that would necessitate Single Instance mode, then the most likely solution would be:

    [ServiceBehavior
    (ConcurrencyMode.Single,
     InstanceContextMode=InstanceContextMode.PerCall)] 
    public class YourService: IYourService
    {
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm starting to develop a web application in PHP that I hope will become
We're starting to develop a Web application that will have some complex functionality written
I am starting to develop a RESTful API (with WCF) which will be working
I am starting to develop with Web Api MVC 4 and created the whole
I’m starting to think about and develop an architecture for a big web application,
I'm starting to develop a web application which works with web-services and EJBs. What
I'm starting to develop a mobile version of a website that we run. Our
Hi there I'm starting to develop an Android app which will be using a
I am just starting to develop Android (being a .Net developer) I am following
We're starting to develop a new Silverlight LOB application where the DataAccess will not

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.