|
Hi,
I have created a WCF server application, and it's consumed by client. Everything works fine!
The problem is that I need to create a thread for every client that is connected to the server. I have read a lot that the web service create automatically a thread for every client. I tried to connect more clients, and it works.
But I need do create thread manually in my WCF server application.
How can I do this?
Thank you!
|
|
|
|
|
|
Well, it is one of the project conditions. Unfortunately, I have no idea how can I do this.
All I know about threads in WCF, is that WCF uses threads from a thread pool to service requests. So when a request begins it draws a thread from this pool to execute the request and after it finishes it returns the thread to the pool.
Thank you for your reply!
|
|
|
|
|
The point is, your project condition is already met. Is this a homework assignment? If not, you have already done what the project is asking.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
you need to explain more what / why you are after creating a thread manually and what you are after achieving in the thread so that we can help you better.
As WCF creates a thread on the IIS server for each instance that it recieves.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
In my Server application I host a web service, which it communicates with client successfully(in localhost). WCF manage the communication between client and service, and it creates threads(automatically) for each client request that is connect.
What I need to do, is creating threads manually in my Server application for each client request.
When thread is started, it will encrypt data's(void function for encrypting) and will sent to the client. after this is done, destroy thread.
|
|
|
|
|
How the host is started:
static void Main(string[] args)
{
Uri httpUrl = new Uri("http://localhost:8010/MyService");
ServiceHost host = new ServiceHost(typeof(ClassLibrary1.Communicatio), httpUrl);
host.AddServiceEndpoint(typeof(ClassLibrary1.IStudent_DB)
, new WSHttpBinding(), "");
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
host.Description.Behaviors.Add(smb);
host.Open();
}
|
|
|
|
|
Solution: Programming WCF Services - O'Reilly //
|
|
|
|