WCF和服务发现超时

时间:2011-05-24 14:42:43

标签: c# wcf service timeout discovery

有人知道如何设置发现超时。默认值类似于10-15s,它接缝有点长......

在女巫方面是否必须配置?服务?客户端?

服务:

            // 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;
        }
    }

提前致谢

1 个答案:

答案 0 :(得分:4)

我认为你需要设置FindCriteria的Duration属性

FindCriteria.Duration Property