有人知道如何设置发现超时。默认值是10-15秒,接缝有点长...
女巫这边需要配置吗?服务?客户?
服务:
// Add a ServiceDiscoveryBehavior
host.Description.Behaviors.Add(new ServiceDiscoveryBehavior());
// Add a UdpDiscoveryEndpoint
host.AddServiceEndpoint(new UdpDiscoveryEndpoint());
客户:
EndpointAddress endPoint = null;
endPoint = FindCalculatorServiceAddress();
static EndpointAddress FindCalculatorServiceAddress()
{
// Create DiscoveryClient
DiscoveryClient discoveryClient = new DiscoveryClient(new UdpDiscoveryEndpoint());
// Find IStringReverser endpoints
FindResponse findResponse = discoveryClient.Find(new FindCriteria(typeof(IStringReverser)));
if (findResponse.Endpoints.Count > 0)
{
return findResponse.Endpoints[0].Address;
}
else
{
return null;
}
}
提前致谢
我相信您需要设置 FindCriteria 的 Duration 属性