How to use WCF to solve a client-server system, which will use the same data source, but will have separate instances / session for each client

I create a server-side client system in which the server must host the service, I tried to use the remote .net network as a means of communication, but ran into problems. I used remote access in past projects, but decided to leave the remote access infrastructure and switch to WCF.

The system is designed as follows: The server must host a service that allows clients to extract data from it. The service also stores specific client instance variables that will allow it to process clients separately (for example, different sessions). The service is designed to source this data from a database (iesdf compact database) executes some logic and passes this data through classes / structures that can be used by clients.

The most important goals are: -Make sure that each client has its own separate session on the server. -Make sure all clients are served using the same instance of the data source.

Another goal is to transfer this data in binary format.

I tried to read and understand that I need a single call mode and a single-tone mode, but every time I read other material, the more I get embarrassed, the more I’m not sure if any of the modes will solve my problem.

If there is anyone who understands my problem, please explain to me the approach to use.

Thanks in advance.


Thanx a lot. I read the first article (@Timothy Khouri) and the features introduced are what I was looking for.

Secondly, I do not want clients to share some data with each other. If I understand the concept of session-based clients, each client has a copy of its server object on the server machine. I want these server objects to use the same linq2sql data object. Am I making a data object (linq2sql object) a private static member? Or how do I do this.

, . , , , , . ?

+5
3

, , 3 . ASMX, CONNECTED ( ), , net.tcp(WCF).

, , , .

WCF

WCF, IIS Net.Tcp

, , , .

+1

@Timothy Khouri

, Singelton, , . Singleton, , .

@johnny g: http://www.stackoverflow.com/questions/1756487/should-wcf-service-typically-be-singleton-or-not

" - , Singleton," " . -! - , "

, ,

0

, , , , . .

, , . , .

-, , WCF / , :

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
public class MyService : IMyService
{ 

This means that when the client opens the channel, he will create an instance of the service; provided that they save this channel, the instance will be saved and they will reuse it.

And in order to use binary transport, you just need to configure the endpoint to use the binding net.tcp-

<service name="MyService">
    <endpoint binding="netTcpBinding" contract="IMyService ... />

A specific configuration implementation may be frustrating for newcomers to WCF — use the Visual Studio WCF configuration tool if you are unsuccessful.

0
source

All Articles