简体   繁体   中英

WCF and service discovery timeout

Does someone know how to set the timeout for discovery. The default value is like 10-15s and it seams a bit long...

On witch side does it have to be configured? Service? Client?

Service:

            // Add a ServiceDiscoveryBehavior
            host.Description.Behaviors.Add(new ServiceDiscoveryBehavior());
            // Add a UdpDiscoveryEndpoint
            host.AddServiceEndpoint(new UdpDiscoveryEndpoint());

Client:

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

Thanks in advance

I believe you need to set the Duration property of FindCriteria

FindCriteria.Duration Property

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM