WCF in Windows application

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi all,

I've created WCF service hosted in WinForm application. I want to use duplex Services because after establishing session between client and the service, in some cases (e.g. at scheduled time) service initiate data transfer.

When I create service as follow:

ServiceHost srvHost = new ServiceHost(typeOf(MyService));

then on server side I have no access to invoke the method from MyService object which send data to the client.

When I create service like this:

MyService mySrv = new MyService();
ServiceHost srvHost = new ServiceHost(mySrv);

then I have an access to invoke methods to send data because I have a reference to mySrv object. The problem is that such service have to have InstanceContextMode set to "Single" so it doesn't support sessions.

My question is: how to implement sending data from application which hosts the WCF duplex service?

Another question is how to identify particular sessions from application which host the service? Application have to send data to only one client which establish session with the service not to all connected clients. Clients have to login to the service at the begining so usernames can identify particular sessions.

Best regards and thanks in advance.
Mariusz
.



Relevant Pages

  • Re: Linksys router and AS/400-iSeries Client Access
    ... > 5250 sessions, and I have the same situation, even if I configure Mochasoft ... > connect to my network using VPN first, ... who responded asked why I was using a firewall if I'm ... I'm now connecting to a different business client ...
    (comp.security.firewalls)
  • Re: Smart client - general data access best practice question
    ... Bandwidth usage is minimal - firstly the sessions are stateful so its only ... We are looking forward to playing with XAML - I believe the server could ... >> has a particular schema that the client understands. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: [PHP] Re: a question on session ID and security
    ... key to identify the users data, then get the "secondary hash key" from ... authenticate that client are stored on the client. ... accepting the one cookie without bothering to authenticate it in any way. ... Sessions should be use to... ...
    (php.general)
  • Re: Browser as Platform (was DesignBais - Impressive)
    ... storing state on the client -- will sessions be managed on the client, ... Given the security on ... trying to work without a Java app-server, like tomcat, on the server. ...
    (comp.databases.pick)