You must Sign In to post a response.
  • Category: ASP.NET

    How to set Timeout for API response in asp.net C# ?

    How to set Timeout for API response for 4 minutes in asp.net C# ?
  • #766977

    WebRequest wc =new WebRequest();
    wc.url="xxxx";
    wc.Timeout=10000 ;//1000 MILLISECONDS
    WebResponse yourWebResponse=wc .GetResponse();

    SRI RAMA PHANI BHUSHAN KAMBHAMPATI

  • #766979
    Hi
    add your webconfig following lines and try again




    <system.web>
    <httpruntime>
    executionTimeout="3600"
    maxUrlLength="10000"
    maxQueryStringLength="80000" />


    <system.web>
    <httpRuntime executionTimeout="180"/>
    </system.web>


    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #766980
    Hi

    try this code also for Increase timer



    <system.serviceModel>
    <bindings>
    <basicHttpBinding>
    <binding name="BasicHttpBinding_IProduction" closeTimeout="00:01:00"
    openTimeout="00:01:00" receiveTimeout="00:10:00"
    sendTimeout="00:10:00" maxBufferPoolSize="2147483647"
    maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"></binding>
    </basicHttpBinding>
    </bindings>


    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #766990
    Hi,
    First change web.config file as:

    <system.web>
    <httpRuntime executionTimeout="99999"/>
    </system.web>

    Then go to IIS--> your web site--> Properties--> ASP.NET tab--> Edit Configuration--> Application, and change it to 99999.
    Or
    You can set PostBackTimeout of your ScriptManager as:

    <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="99999">
    </asp:ScriptManager>

    Or
    You can set the ScriptRuntime inside the method where you are calling Api method as follows:
     
    HttpContext.Current.Server.ScriptTimeout = 99999;

  • #767017
    If you are using wcf service please go through the url . For my project I had done to solve the problem.
    url..
    http://www.dotnetspider.com/resources/45513-Requested-Timed-Out-for-a-Wcf-service.aspx use basichttpbinding instead of wsHttpBinding that will solve the problem

    SRI RAMA PHANI BHUSHAN KAMBHAMPATI


Sign In to post your comments