Tag: 服务发现

WCF发现找到端点但主机是“localhost”

我正在尝试使用http://msdn.microsoft.com/en-us/library/dd456783(v=VS.100).aspx作为起点在WCF中使用发现function。 它在我的机器上工作正常,但后来我想在另一台机器上运行该服务。 该服务被正确发现,但找到的服务的主机名始终是“localhost”,当然没什么用处。 服务端点: var endpointAddress = new EndpointAddress(new UriBuilder { Scheme = Uri.UriSchemeNetTcp, Port = port}.Uri); var endpoint = new ServiceEndpoint(ContractDescription.GetContract(typeof(IServiceInterface)), new NetTcpBinding (), endpointAddress); 客户: static EndpointAddress FindServiceAddress() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); DiscoveryClient discoveryClient = new DiscoveryClient(new UdpDiscoveryEndpoint()); // Find endpoints FindResponse findResponse = discoveryClient.Find(new FindCriteria(typeof(T))); Console.WriteLine(string.Format(“Searched for {0} seconds. […]

客户端应用程序在C#中在本地网络上查找服务器的最佳方式是什么?

客户端使用GenuineChannels连接到服务器(我们正在考虑切换到DotNetRemoting)。 我的意思是找到要连接的服务器的IP和端口号。 看起来像蛮力的方法是尝试网络上的每个IP尝试活动端口(甚至不确定是否可能)但必须有更好的方法。