13

I make a web request to a third-party api from my ASP.NET Core application.

  1. When app is running alone itself, request succeeds.
  2. When app is running in IIS on the same server, request timeouts.

Request is made from a Hangfire recurring job to Asana API endpoint (HTTPS) via RestSharp client. All the own app's pages are available through IIS, but app cannot make any requests.

Where should I look and what to debug to solve this problem?

Mikhail Zhuravlev
  • 969
  • 2
  • 10
  • 22

1 Answers1

18

IIS behavior is driven by the web.config, I have configured to deal with request < 20 min specifying requestTimeout="00:20:00":

<aspNetCore
  requestTimeout="00:20:00"
  processPath="%LAUNCHER_PATH%"
  arguments="%LAUNCHER_ARGS%"
  stdoutLogEnabled="false"
  stdoutLogFile=".\logs\stdout"
  forwardWindowsAuthToken="false">
  <environmentVariables>
    <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="staging" /> <!-- value could be "development", "staging" or "production"-->
  </environmentVariables>
</aspNetCore>
Daboul
  • 2,635
  • 1
  • 16
  • 29
  • 1
    Doesn't it set timeout for requests that come _into_ IIS? Because my problem is related to requests that come from the app to another app on anoter server with a RestSharp client. And when app is running without IIS, those requests are passing ok. – Mikhail Zhuravlev Mar 29 '17 at 17:40
  • 1
    My bad, I didn't get you right then. But what does trigger the call from your ASP.NET Core, an incoming call to IIS right? What about your application if your incoming call from IIS timeout? Wouldn't your app and its request get interrupted as well? Not sure about that, just a supposition. – Daboul Mar 29 '17 at 17:55
  • No, there is no incoming request, it's a recurring job set with Hangfire. – Mikhail Zhuravlev Mar 30 '17 at 09:26
  • Is it possible to specify requestTimeout as an environment variable ala `%LAUNCHER_PATH%`? When I attempt this, intellisense indicates `The string '%REQUEST_TIMEOUT%' is not a valid Time value.` and my navigating to my webapp gives: The specified CGI application encountered an error and the server terminated the process. – ElFik Apr 03 '19 at 22:41
  • 1
    @Daboul - This is good information but this setting is not applied. Reason with details is - I read the details for these settings on this page - learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/… & it turned out that default hostingModel setting is InProcess & requestTimeout setting for this hosting model is ignored. Here is snap from that page "Doesn't apply to in-process hosting. For in-process hosting, the module waits for the app to process the request." Please let me know about this. – SO19 May 22 '21 at 14:06
  • so how to activate if the hostingmodel is inprocess sir? – toha May 13 '22 at 16:17
  • SO19 == Mikhail Zhuravlev? Or just hijacked the question? – The incredible Jan Mar 09 '23 at 10:54