none
System.ServiceModel.CommunicationException : The request was aborted: The request was canceled. RRS feed

  • Question

  • The more information of Detail:

    ---------------------------------------------------------------------------------------------------------------

    Detail

    System.ServiceModel.CommunicationException: An error (The request was aborted: The request was canceled.) occurred while transmitting data over the HTTP channel. ---> System.Net.WebException: The request was aborted: The request was canceled.
       at System.Net.HttpWebRequest.GetResponse()
       at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
       --- End of inner exception stack trace ---
    
    Server stack trace: 
       at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
       at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
       at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.ClientReliableChannelBinder`1.RequestClientReliableChannelBinder`1.OnRequest(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode)
       at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode)
       at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    
    Exception rethrown at [0]: 
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at PackageFH.Service.IPkgFHBooking.GetProductDailyMinPrices(List`1 productMasters, Boolean isTest)
       at PackageFH.Booking.BookingHelper.GetProductInfos[T](List`1 ids, ProductType searchType) in d:\Builds\9\PackageFH\PackageFH.Deploy.Release.Online.Sitea\Sources\DEV\PackageFH\PackageFH.Booking\BookingHelper.cs:line 666
       at PackageFH.Online.Site.Controllers.ProductController.List(SearchBoxModel model) in d:\Builds\9\PackageFH\PackageFH.Deploy.Release.Online.Sitea\Sources\DEV\PackageFH\PackageFH.Online.Site\Controllers\ProductController.cs:line 174
       at lambda_method(Closure , ControllerBase , Object[] )
       at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<invokeactionmethodwithfilters>b__12()
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)</invokeactionmethodwithfilters>

    -----------------------------------------------------------------------------------------------

    we create one service by wcf , then we create one function that the name is GetProductDailyMinPrices , In the method , we will query price of product , the num of product is ten at most .  now , in the production ,the website throw one exception based on the above information . I have tried to modify the setting of binding and httpruntime, like this : receiveTimeOut\sendTimeOut\maxRequestLength  . but these don't have any effect .

    SOS.

    Thanks for your help !



    • Edited by Todd.Zhao Tuesday, September 2, 2014 9:06 AM cut-off rule
    Tuesday, September 2, 2014 9:04 AM

Answers

  • Hi Tooooodd,

    For this situation, about the error message "System.ServiceModel.CommunicationException: An error (The request was aborted: The request was canceled.) occurred while transmitting data over the HTTP channel.", you could use this custom binding as equivalent to BasicHttpBinding without HTTP keep alive:

    <bindings>
      <customBinding>
        <binding name="NoKeepAlive">
          <textMessageEncoding messageVersion="Soap11" />
          <httpTransport keepAliveEnabled="false" />
        </binding>
      </customBinding>
    </bindings> 

    For more detailed information, you could refer to:

    http://stackoverflow.com/questions/3900040/system-net-webexception-the-request-was-aborted-the-request-was-cancelled

    http://www.paullemke.com/2011/01/26/wcf-and-http-keep-alives/

    Regards

    • Marked as answer by Todd.Zhao Wednesday, September 3, 2014 3:05 PM
    Wednesday, September 3, 2014 2:12 AM
    Moderator
  • Dear  Shawn-MSFT:

    Thanks for your help !

            I have tried three ways :

    1. change the length of maxRequestLength:

    		<system.web> <httpRuntime maxRequestLength="10240" />

    2.  change the time of receiveTimeOut and sendTimeOut:

    <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IScriptRunHost" closeTimeout="00:10:00"
                        openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"

    3. change the way of binding to customBinding

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

                 All above , can do work very well ,but can't fix my problem .

         Today , I recorded some logs of my program , I found the param of the method that convert it to JSON , the length of it is very long , I think it longer than the maxRequestLength . like this , I must transmit one object that name is Product , actually , the object of product just have twenty property, but it have some child class , one of these name is ProdVersionLog , it have one thousand records , so it's too long .

        Now , I only transmit some property of the object product , the problem don't appear  and fix the bug . Very happy !

       So , I think the 'mic' don't give some correct message to us  in the wcf . It's very terrible .

    • Marked as answer by Todd.Zhao Wednesday, September 3, 2014 8:20 AM
    Wednesday, September 3, 2014 8:17 AM

All replies

  • Hi Tooooodd,

    For this situation, about the error message "System.ServiceModel.CommunicationException: An error (The request was aborted: The request was canceled.) occurred while transmitting data over the HTTP channel.", you could use this custom binding as equivalent to BasicHttpBinding without HTTP keep alive:

    <bindings>
      <customBinding>
        <binding name="NoKeepAlive">
          <textMessageEncoding messageVersion="Soap11" />
          <httpTransport keepAliveEnabled="false" />
        </binding>
      </customBinding>
    </bindings> 

    For more detailed information, you could refer to:

    http://stackoverflow.com/questions/3900040/system-net-webexception-the-request-was-aborted-the-request-was-cancelled

    http://www.paullemke.com/2011/01/26/wcf-and-http-keep-alives/

    Regards

    • Marked as answer by Todd.Zhao Wednesday, September 3, 2014 3:05 PM
    Wednesday, September 3, 2014 2:12 AM
    Moderator
  • Dear  Shawn-MSFT:

    Thanks for your help !

            I have tried three ways :

    1. change the length of maxRequestLength:

    		<system.web> <httpRuntime maxRequestLength="10240" />

    2.  change the time of receiveTimeOut and sendTimeOut:

    <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IScriptRunHost" closeTimeout="00:10:00"
                        openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"

    3. change the way of binding to customBinding

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

                 All above , can do work very well ,but can't fix my problem .

         Today , I recorded some logs of my program , I found the param of the method that convert it to JSON , the length of it is very long , I think it longer than the maxRequestLength . like this , I must transmit one object that name is Product , actually , the object of product just have twenty property, but it have some child class , one of these name is ProdVersionLog , it have one thousand records , so it's too long .

        Now , I only transmit some property of the object product , the problem don't appear  and fix the bug . Very happy !

       So , I think the 'mic' don't give some correct message to us  in the wcf . It's very terrible .

    • Marked as answer by Todd.Zhao Wednesday, September 3, 2014 8:20 AM
    Wednesday, September 3, 2014 8:17 AM
  • just now ,i think may be it's one way that what you said to solve the problem  what i posted .

    I think we should see the type of the exception , it's "System.ServiceModel.CommunicationException: An error" of my error .

    Wednesday, September 3, 2014 3:05 PM