silverlight 3: long running wcf call triggers 401.1 (access denied)

Posted by sympatric greg on Stack Overflow See other posts from Stack Overflow or by sympatric greg
Published on 2010-05-28T17:55:20Z Indexed on 2010/05/28 20:22 UTC
Read the original article Hit count: 353

I have a wcf service consumed by a silverlight 3 control. The Silverlight client uses a basicHttpBindinging that is constructed at runtime from the control's initialization parameters like this:

public static T GetServiceClient<T>(string serviceURL)
{
    BasicHttpBinding binding = new BasicHttpBinding(Application.Current.Host.Source.Scheme.Equals("https", StringComparison.InvariantCultureIgnoreCase)
            ? BasicHttpSecurityMode.Transport : BasicHttpSecurityMode.None);
    binding.MaxReceivedMessageSize = int.MaxValue;
    binding.MaxBufferSize = int.MaxValue;

    binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;

    return (T)Activator.CreateInstance(typeof(T), new object[] { binding, new EndpointAddress(serviceURL)});
 }

The Service implements windows security. Calls were returning as expected until the result set increased to several thousand rows at which time HTTP 401.1 errors were received.

The Service's HttpBinding defines closeTime, openTimeout, receiveTimeout and sendTimeOut of 10 minutes.

If I limit the size of the resultset the call suceeds.

Additional Observations from Fiddler: When Method2 is modified to return a smaller resultset (and avoid the problem), control initialization consists of 4 calls: Service1/Method1 -- result:401 Service1/Method1 -- result:401 (this time header includes element "Authorization: Negotiate TlRMTV..." Service1/Method1 -- result:200 Service1/Method2 -- result:200 (1.25 seconds)

When Method2 is configured to return the larger resultset we get: Service1/Method1 -- result:401 Service1/Method1 -- result:401 (this time header includes element "Authorization: Negotiate TlRMTV..." Service1/Method1 -- result:200 Service1/Method2 -- result:401.1 (7.5 seconds) Service1/Method2 -- result:401.1 (15ms) Service1/Method2 -- result:401.1 (7.5 seconds)

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about timeout