locked
WCF RIA Services fail with authentication error if service call is more than 20 seconds RRS feed

  • Question

  • I have a Silverlight application which uses WCF RIA services and WindowsAuthentication mode.  When I deploy to our web server calls that are greater than 20 seconds in length seem to lose authentication and I get a dialog box from IE to re-enter my username and password.

    Does anyone know how to fix this issue?

    Wednesday, August 3, 2011 9:03 PM

Answers

  • UPDATE: I found out that the issue had nothing to do with what Fiddler was indicating and the authentication dialog was a side effect of another issue.

    When I turned on WCF diagnostic tracing I found that what was really happening was that the service was throwing an exception due to the max number of items in graph. My bindings in my web.config to override the service had an old service name so it was not picked up.

    Based on this I would highly suggest that anyone having an issue turn on WCF diagnostic tracing on the web server and see what that says before following an error out of fiddler...

    Thanks for the response to the post and your will to help out...

    • Marked as answer by FishHandler Thursday, August 4, 2011 7:38 PM
    Thursday, August 4, 2011 7:38 PM

All replies

  • Hi Fish,

    Welcome!

    I think you should repost here: http://forums.silverlight.net/53.aspx/1?WCF+RIA+Services for better supports.

    Thanks for your understanding.

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, August 4, 2011 9:05 AM
    Moderator
  • hi Fish,

    Create an extension method:

    var domainContextTimeout = TimeSpan.FromMinutes(5);

    var context = new SearchContext().SetTimeout<SearchContext>(domainContextTimeout));

    public static class DomainClientExtensions{

            public static T SetTimeout<T>(this DomainContext domainContext, TimeSpan domainContextTimeout)  

                {

                         var channelFactory = (ChannelFactory)domainContext.DomainClient.GetPropertyValue("ChannelFactory");

                         channelFactory.Endpoint.Binding.OpenTimeout = domainContextTimeout;

                         channelFactory.Endpoint.Binding.CloseTimeout = domainContextTimeout;

                        channelFactory.Endpoint.Binding.SendTimeout = domainContextTimeout;

                       return Guard.As<T>(domainContext);

                  }

     

        public static object GetPropertyValue(this object instance, string propertyName)    

         {  return instance.GetType().GetProperty(propertyName).GetValue(instance, null);       }

    }


    Regards, http://shwetamannjain.blogspot.com
    Thursday, August 4, 2011 9:26 AM
  • Hi Fish,

    check this appraoch:

    http://blogs.msdn.com/b/kylemc/archive/2010/11/03/how-to-change-the-request-timeout-for-wcf-ria-services.aspx

     


    Regards, http://shwetamannjain.blogspot.com
    Thursday, August 4, 2011 9:28 AM
  • Thank you

     


    Greg Vig
    Thursday, August 4, 2011 3:35 PM
  • I have extended the onCreated method with the following.   I think it is performing the same functionality??

    public sealed partial class ProjectDomainContext : DomainContext
    
     {
    
      partial void OnCreated()
    
      {
    
       // Set timeout values for service.
    
       ((WebDomainClient<ProjectDomainContext.IProjectDomainServiceContract>)
    
        this.DomainClient).ChannelFactory.Endpoint.Binding.ReceiveTimeout = new System.TimeSpan(0, 5, 0);
    
       ((WebDomainClient<ProjectDomainContext.IProjectDomainServiceContract>) 
    
        this.DomainClient).ChannelFactory.Endpoint.Binding.SendTimeout = new System.TimeSpan(0, 5, 0);
    
       ((WebDomainClient<ProjectDomainContext.IProjectDomainServiceContract>) 
    
        this.DomainClient).ChannelFactory.Endpoint.Binding.OpenTimeout = new System.TimeSpan(0, 5, 0);
    
       ((WebDomainClient<ProjectDomainContext.IProjectDomainServiceContract>)
    
        this.DomainClient).ChannelFactory.Endpoint.Binding.CloseTimeout = new System.TimeSpan(0, 5, 0);
    
      }
    
     }

     

    Thursday, August 4, 2011 3:39 PM
  • UPDATE: I found out that the issue had nothing to do with what Fiddler was indicating and the authentication dialog was a side effect of another issue.

    When I turned on WCF diagnostic tracing I found that what was really happening was that the service was throwing an exception due to the max number of items in graph. My bindings in my web.config to override the service had an old service name so it was not picked up.

    Based on this I would highly suggest that anyone having an issue turn on WCF diagnostic tracing on the web server and see what that says before following an error out of fiddler...

    Thanks for the response to the post and your will to help out...

    • Marked as answer by FishHandler Thursday, August 4, 2011 7:38 PM
    Thursday, August 4, 2011 7:38 PM