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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:09:57+00:00 2026-05-14T00:09:57+00:00

I have a self-hosted WCF service with the InstanceContextMode set to PerSession. How can

  • 0

I have a self-hosted WCF service with the InstanceContextMode set to PerSession.
How can I detect new client connections (sessions) to my service from the host application and use that new session context to observe my service through its events?

Something like:

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
public class MyService : IMyService {
    public event EventHandler ClientRegistered;
    public event EventHandler FileUploaded;
}

and from my host application to be able to do:

ServiceHost svc = new ServiceHost(typeof(MyService));
svc.Open();

// something like:
svc.NewSession += new EventHandler(...)

//...

public void SessionHandler(InstanceContext SessionContext) {
    MySessionHandler NewSessionHandler = new MySessionHandler(SessionContext);

    // From MySessionHandler I handle the service's events (FileUploaded, ClientRegistered) 
    // for this session and notify the UI of any changes.
    NewSessionHandler.Handle();
}
  • 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-14T00:09:57+00:00Added an answer on May 14, 2026 at 12:09 am

    You can use IsInitiating in the service contract

    [OperationContract(IsInitiating = true)]
       void FirstMethod();
    

    See the following link:

    http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/8137553a-8657-475e-b9ca-5914d9c9d57a

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

Sidebar

Related Questions

I have Laconica (self hosted twitter ) configured on my local intranet and would
I have a self built JSP webapp and at the moment I'm using tomcats
I have a self-referencing table with an Id, CategoryName, and ParentId. It's a typical
I have a class: class MyClass: def __init__(self, foo): if foo != 1: raise
I have implemented a linked list as a self-referencing database table: CREATE TABLE LinkedList(
I have the following code: class IncidentTag: def __init__(self,tag): self.tag = tag def equals(self,obj):
I have a VB6 application that needs to update it's self. For this purpose,
I have the following example code: class A(object): def __init__(self, id): self.myid = id
I have an object. fp = open(self.currentEmailPath, rb) p = email.Parser.Parser() self._currentEmailParsedInstance= p.parse(fp) fp.close()
I have a nib that I load the usual way [NSBundle loadNibNamed:@AuthorizationWindow owner:self]; and

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.