The time allotted to this operation may have been a portion of a longer timeout

Unanswered The time allotted to this operation may have been a portion of a longer timeout

  • Wednesday, April 11, 2012 1:52 PM
     
     

    I m gettin the error message "The HTTP request to 'http://localhost:8888/MyService/MyService/' has exceeded the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout." When the service is hosted on console application and called from webapp.

    The same scenario works when it is called from VS2008 IDE meaning Host console application and web application running in same VS2008 Solution.

    I am using wsHttpBinding,I have tried with below workarounds

    1. Increased the timeout values in client config file.
    2. Configured security tag in bindings to None
    3. Added dataContractSerilizer in serviceBehaviours
    4. Added serviceThrottling in serviceBehaviours

    Still getting the same error, Can anybody plz tell me were i m goin wrong. Below is the trace

    System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
    System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
    System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
    System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
    System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
    System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
    System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
    System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
    WebUIApp.MyService.IMyWcfService.GetLicenseExpiryDate()
    WebUIApp.MYService.MyWcfServiceClient.GetLicenseExpiryDate()
    WebUIApp.Login.Page_Load(Object sender, EventArgs e)
    System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
    System.Web.UI.Control.OnLoad(EventArgs e)
    System.Web.UI.Control.LoadRecursive()
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    System.Web.UI.Page.ProcessRequest()
    System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
    System.Web.UI.Page.ProcessRequest(HttpContext context)
    ASP.login_aspx.ProcessRequest(HttpContext context)
    System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
    System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
    System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
    System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
    System.Web.HttpRuntime.ProcessRequest(HttpWorkerRequest wr)
    Microsoft.VisualStudio.WebHost.Request.Process()
    Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Connection conn)

All Replies

  • Friday, April 13, 2012 2:31 AM
    Moderator
     
     
    You need to configure the operation timeout property for proxy in the WCF client code, to set this operation timeout property configuration, you have to cast your proxy to IContextChannel in WCF client application before calling the operation contract methods. or try increasing timeout settings (such as: open/close/receive/send) in your <binding> element in the server and client config file, and apply the binding name to the bindingconfiguration attribute of endpoint, if you transfer large file between server and client, you also need to consider increasing maxReceivedMessageSize value on client side.

    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

  • Friday, April 13, 2012 5:53 AM
     
      Has Code

    What kind of binding you use ?

    I would recomend you to enable trace on WCF service and see the real exceptions. To enable Tracing you can refer,

    http://blogs.msdn.com/madhuponduru/archive/2006/05/18/601458.aspx

    Yes, You can increase the timeOut by

    var myService = new ServiceClient(...);
    myService.InnerChannel.OperationTimeout = new TimeSpan(....);

    And You can increase the try adding the timout value in your web.config file as

    <httpRuntime executionTimeout="90" /> 


    Lingaraj Mishra


  • Friday, April 13, 2012 7:07 AM
     
     

    I am using wsHttpBinding 

    Have enabled enabled WCF tracing on both client and server.I m not recieving any exception on server trace but the client throws the timeout exception. The trace mentioned in my post is from svctraceviewer

    i have also set the executionTimeout="300" in client config

    Raj

  • Friday, April 13, 2012 7:12 AM
     
      Has Code

    I have tried by increasing various timeouts. Still the error persists. Below is my client binding

    <wsHttpBinding>

    <binding name="WSHttpBinding_IMyService" closeTimeout="00:01:00"
              openTimeout="00:20:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
              bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
              maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
              textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
              <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" />
              <reliableSession ordered="true" inactivityTimeout="00:10:00"
                enabled="false" />
              <security mode="None">
                <transport clientCredentialType="Windows" proxyCredentialType="None"
                  realm="" />
                <message clientCredentialType="Windows" negotiateServiceCredential="true"
                  establishSecurityContext="true" />
              </security>
            </binding>
     </wsHttpBinding>

  • Friday, April 13, 2012 7:29 AM
     
      Has Code

    Actually this is whats happening with this issue.

    The first time the client is trying to contact the WCF application it is failing.

    Hence we have wrapped it around a try catch block as follows:

    while(true)
    {
    try 
      {
        try to connect to the WCF connection;
        break;
      }
    catch(Exception e)
      {
      }
    }
    The first time the connection is timing out and throwing an exception. However the second time it is succeeding.
  • Friday, April 13, 2012 12:22 PM
     
      Has Code

    I remember of fixing this kind of issue by setting Keep alive property to false.

    But this can be changed on the WCF client configuration only in custom binding or by writing code. An alternate approach would be, as below,

    var proxy = new MyServiceClient();
    var customBinding = new CustomBinding(proxy.Endpoint.Binding);
    var transportElement = 
    customBinding.Elements.Find<HttpTransportBindingElement>();
     transportElement.KeepAliveEnabled = false; 
     proxy.Endpoint.Binding = customBinding; 

    You can find the reason about how it works from

    http://stackoverflow.com/questions/4227722/error-when-making-first-wcf-service-call


    Lingaraj Mishra

  • Friday, April 13, 2012 9:47 PM
     
     

    Thanks Lingaraj, I tried the above code still i m gettin the same error.......

    System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
    WebUIApp.MyService.IMyWcfService.GetLicenseExpiryDate()
    WebUIApp.MYService.MyWcfServiceClient.GetLicenseExpiryDate()
    WebUIApp.Login.Page_Load(Object sender, EventArgs e)

    From the above trace i can say that service call is failing after "System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)" call

    Let me explain my VS solution in brief. My WCF Host is windows forms application and client is web appliaction

    In my WCF project i have 2 Servicecontracts. Each of them configured and accessed via 2 differnt end points.I have used the same type of Binding and service behaviours for both of the end points. I am not getting any exceptions while accessing operationcontracts of servicecontract1 but when trying to access any of the operationcontracts of servicecontract2 fails for the 1st time.

    Also there are some operationcontracts in servicecontract2 which will call servicecontract1's opertioncontract.

    Where as the above mentioned setup works fine in VS2008 IDE, where the host is wcfProject and client is webapplication.

    I think there is some problem with my WCF host application.

    My doubts is, do the services communicating with each other should b hosted on different hosts ?


    Raj

  • Monday, April 16, 2012 6:34 AM
    Moderator
     
     

    As for the first time to call servicecontracts, whether it needs to do much initialization? Why do want host your WCF services in windows forms? you can try hosting them in IIS. If you host these services in Windows form, you need to make sure that each service is running. It does not need to host the services communicating with each other on different hosts.

    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

  • Tuesday, April 17, 2012 12:50 PM
     
     

    I m getting the timeout exception in service1 when service1 is trying to call service2's method.

    Also i m using [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)] in both services.


    Raj


    • Edited by RajRampur Tuesday, April 17, 2012 1:25 PM
    •