How to open multiple service host for same address,binding contract?
-
Hi All, I am giving my code below. for (int i = 0; i <= 50; i++) { ServiceHost host=new ServiceHost(); host.AddServiceEndpoint(contract, binding,"net.tcp://16.69.13.55:1000/"); host.Open(); ChannelFactory<IAsyncInterface> factory; factory = new ChannelFactory<IAsyncInterface>(binding, fullBaseAddress); iAsync = factory.CreateChannel(); ((IContextChannel)iAsync).OperationTimeout = new TimeSpan(00, 10, 00); iAsync.BeginNew(i.ToString(), new AsyncCallback(OnEndGetNew), null); } i am calling WCF service asynchronously. first time its opening host properly.but when it tries to open second time i am getting error like this. "The ChannelDispatcher at 'net.tcp://16.69.13.55:1000/FlexiAsyncServer' with contract(s) '"IAsyncInterface"' is unable to open its IChannelListener.". can any one please tell me how to solve this issue? or is there any other way to do this? Thanks Lijo.
-
Hi All, I am giving my code below. for (int i = 0; i <= 50; i++) { ServiceHost host=new ServiceHost(); host.AddServiceEndpoint(contract, binding,"net.tcp://16.69.13.55:1000/"); host.Open(); ChannelFactory<IAsyncInterface> factory; factory = new ChannelFactory<IAsyncInterface>(binding, fullBaseAddress); iAsync = factory.CreateChannel(); ((IContextChannel)iAsync).OperationTimeout = new TimeSpan(00, 10, 00); iAsync.BeginNew(i.ToString(), new AsyncCallback(OnEndGetNew), null); } i am calling WCF service asynchronously. first time its opening host properly.but when it tries to open second time i am getting error like this. "The ChannelDispatcher at 'net.tcp://16.69.13.55:1000/FlexiAsyncServer' with contract(s) '"IAsyncInterface"' is unable to open its IChannelListener.". can any one please tell me how to solve this issue? or is there any other way to do this? Thanks Lijo.
Hello, if you open multiple channel listeners on the same TCP port you have to use Port Sharing service and port sharing has to be allowed on the endpoint: NET.TCP Port sharing. Btw. why do you try to open 50 instances of the host for the same service when single host instance can handle 50 requests? Best regards, Ladislav
-
Hello, if you open multiple channel listeners on the same TCP port you have to use Port Sharing service and port sharing has to be allowed on the endpoint: NET.TCP Port sharing. Btw. why do you try to open 50 instances of the host for the same service when single host instance can handle 50 requests? Best regards, Ladislav
Hi, Thanks a lot for your reply. I will clearly explain my scenario. I have a single Service Contract. And this Interface will be implemented in different classes. Because in each class the implimentation will be different.So for opening the service host i need to provide the type of these classes. That i will come to know ony at run time. I am getting that type information from database. So each time when loop comes in the type will be diffrent.In that case how i can do it? because i will be getting multiple types from database.thats why i put it in loop. Can u please suggest me a better way to do this? Thanks Lijo