Click here to Skip to main content
14,924,198 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to host two services
1. Service 1 (located on D Drive)
process data based on configuration configured in xml
net.tcp://ServerIP/Pune_service
2. Service 2 (located on E Drive)
process data based on configuration configured in xml
net.tcp://ServerIP/Mumbai_service

now i tried to host these services with net.tcp binding in two different Windows Service
Windows service 1 Started Sucessfully
but when tried to start second windows service i'am getting Error i.e.
AddressAlreadyInUseException.

What I have tried:

i tried with port sharing enable
Port Sharing Features in WCF[^]

but didnt work
Posted
Updated 31-Aug-18 8:49am
v5
Comments
Member 11020938 26-Aug-18 7:51am
   
Are you trying to host both the services in the same IIS? If so, are you creating applications in the IIS and hosting them?
kedar001 26-Aug-18 13:21pm
   
no i'am trying to host service in windows Service..
Richard Deeming 28-Aug-18 15:21pm
   
Try the Microsoft documentation:
Net.TCP Port Sharing | Microsoft Docs[^]

1 solution

You must define each TCP/IP "Listener" to be on a different port, such as ports 12001 and 12002.

If they are both trying to listen on the same port then they will clash and generate the AddressAlreadyInUseException.

An alternative is to have a "front-end" service that does the listening on a single port and then passes the requests to each service based on it's type or defined destination ("Pune" or "Mumbai") - possibly using names pipes or something similar.
   
v2
Comments
kedar001 3-Sep-18 0:28am
   
thanks for the reply.
how i can define listener to different port.
i tried with different port but i'm getting TCP error :10013

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900