I have IIS (10.0) on Windows Server 2019 (v.1809) and a few asp net core applications. And I have corporate proxy. The problem is that applications can't go pass it:
System.Net.Http.HttpRequestException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Or in some other sites:
System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it.
From browsers (IE, Chrome) links work. Another server with IIS, same applications and same proxy settings works fine too.
I tried to set proxy settings specifically in config files, but it didn't help. From here: How to set proxy settings for IIS processes?
What else can I do?
Edit: I created ASP Net Framework web-app and run it on the same server. Witout proxy it didn't work, but with proxy in web.config (in site folder or in Microsoft.NET folder) it worked. For Core I still have not found a solution.
Code is the same in ASP Net and ASP Net Core:
public async Task<IActionResult> Index()
{
using (var client = new HttpClient())
{
try
{
var message = await client.GetStringAsync("http://webcode.me");
ViewBag.Message = message;
}
catch (Exception ex)
{
ViewBag.Message = ex.ToString();
}
}
return View();
}
After so many tries to overcome proxy in the end it was problem with organization network settings. Resolved with technical support help.