Aşağıda, ana bilgisayar windows hizmetimin benim app.config dosya snippet'ım var.Tek bir pencerede tek bir TCP bağlantı noktasında birden çok WCF hizmetini barındırma hizmeti
<services>
<service name="Share.Services.MainService">
<endpoint address="net.tcp://localhost:8001/MainService" behaviorConfiguration="netTcpBehavior" binding="netTcpBinding" contract="Share.Services.IClaimService" />
</service>
<service name="Share.Services.MainMasterPageService">
<endpoint address="net.tcp://localhost:8001/MainMasterPageService" behaviorConfiguration="netTcpBehavior" binding="netTcpBinding" contract="Share.Services.IMainMasterpageService" />
</service>
<service name="Share.Services.SMSService">
<endpoint address="net.tcp://localhost:8001/SMSService" behaviorConfiguration="netTcpBehavior" binding="netTcpBinding" contract="Share.ServiceContracts.Messaging.ISMSService" />
</service>
</services>
ben Servisi kayıt kodunun altına kullanıyorum pencereler hizmetinde 8001 portu ile TCP bitiş noktası kullanmak üzere yapılandırılmış 3 wcf hizmeti Orada RegisterServiceHost işlevini arıyorum her ServiceHost nesnesi için
private static ServiceHost[] Hosts = null;
public static void Start()
{
try
{
while (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
{
System.Threading.Thread.Sleep(1000);
}
BaseLog.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
Hosts = new ServiceHost[]
{
new ServiceHost(typeof(MainService)),
new ServiceHost(typeof(MainMasterPageService)),
new ServiceHost(typeof(SMSService))
};
foreach (ServiceHost host in Hosts)
{
RegisterServiceHost(host);
}
_log.Info("All Hosts Open");
}
catch(Exception e)
{
_log.Error("MainServiceHost", e);
}
}
hosts vardır , bu işlevin kodu aşağıdaki gibi kodun sorunsuz bir şekilde çalışıyor. Sorum şu: tüm servisler 8001 numaralı bağlantı noktasını paylaşıyor. Tüm servisler aynı bağlantı noktasını paylaşabiliyor. Net.TCP Bağlantı Noktası Paylaşım Hizmeti bile makinede etkin değil. Diğer sorum, aynı bağlantı noktasını paylaşmada herhangi bir performans etkisine neden olacak olmasıdır. Her hizmet için 8001.8002, 8003 gibi benzersiz bir port verirse, o zaman bunun avantajı nedir?