locked
Configure a timeout in web.config for a web service RRS feed

  • Question

  • User661707418 posted

    Hello everybody,
    I have a web service hosted in IIS 7.5.
    The web service works fine.
    I try to configure a timeout in the web.config, but I can't do it.
    I tried in my web.config :

    <Configuration>
    <system.web>
    <compilation debug="false" targetFramework="4.8" />
    <httpRuntime targetFramework="4.8" executionTimeout="10" /> <!-- 10 seconds -->
    <sessionState timeout="2" /> <!-- 2 minutes -->
    </system.web>
    </Configuration>

    and in the web service controller :

    Thread.Sleep(180000) //3 minutes

    I thought the execution would stop after 10 seconds but instead it stops after 1 minute, whatever I put in the "executionTimeout" and "timeout" parameters.
    I have searched in IIS but impossible to find what this minute corresponds to.

    Does someone have an idea ?

    Thanks a lot in advance.

    Eric.

    Saturday, June 20, 2020 10:26 AM

All replies

  • User-848649084 posted

    Hi,

    Could you please provide more information about which kind of web service you are using. in iis, there is different time out setting for every kind of web service.

    <httpRuntime targetFramework="4.8" executionTimeout="10" /> <!-- 10 seconds -->
    

    executionTimeout:

    Specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET.

    This time-out applies only if the debug attribute in the compilation element is False. To help to prevent shutting down the application while you are debugging, do not set this time-out to a large value.

    The default is "00:01:50" (110 seconds).

    you could try to set the connection Time out value by following below steps:

    1)Open iis manager, select your site.

    2)click advance setting from the action pane.

    3)Expand section "Connection Limits", here you can set your "connection time out"

    refer this below link for more detail:

    https://forums.iis.net/post/2152920.aspx

    Regards,

    Jalpa

    Monday, June 22, 2020 6:41 AM
  • User661707418 posted

    Hi Jalpa,

    Thanks for your reply.

    My web service is a REST one and is written in C#, it is not asynchronous.

    As you proposed, I set :

    • the execution timeout,
    • the session state timeout (with debug= false),
    • the connection limits connectionTimeout.

    I set them all at 10 seconds.

    But it's the same : the web service fails after 30 seconds.

    Regards.

    Eric

    Monday, June 22, 2020 12:41 PM
  • User-848649084 posted

    try to remove all the time out value from your site setting and thread. sleep value and only set Connection Limits value and check the result. do not forget to restart the site after doing changes. also clear browser cache and history.

    Tuesday, June 23, 2020 9:30 AM
  • User-848649084 posted

    Hi,

    Is your issue solved?

    If your issue is solved then I request you to mark the helpful suggestion as an answer. This will help other people who face the same issue.

    If your issue still exists then try to refer the solution given by the community members.

    If then also you have any further questions then let us know about it.

    We will try to provide further suggestions to solve the issue.

    Thanks for your understanding.

    Regards

    Jalpa.

    Friday, July 10, 2020 3:21 AM