0

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();
     }
Zi Cold
  • 165
  • 8
  • Does this answer your question? [asp.net core defaultProxy](https://stackoverflow.com/questions/42637592/asp-net-core-defaultproxy) – Lex Li Jul 08 '22 at 22:58
  • @LexLi Thank you for the link! But setting evironment variables didn't help (as for system variables too). – Zi Cold Jul 09 '22 at 10:06
  • If the options in that thread didn't help, we can only imagine the code that gave you the exception was written in a non-standard way. Either you share the actual code snippet by editing the question, or you escalate this back to the developer(s) so that they can take a further look. – Lex Li Jul 09 '22 at 16:45
  • @LexLi The problem is that the same code I run in console app to test connection. And it worked. And the same code I run on another IIS server and it worked too. I'm just lost here. – Zi Cold Jul 11 '22 at 21:15
  • Every machine can be different due to complexity in system configuration and impact from other apps on the same machine. So unless you share the code, nobody else can give more hints on what to look for, as none of them has access to the machines like you. – Lex Li Jul 11 '22 at 21:59
  • @LexLi I added code and asp net framework experiment. – Zi Cold Jul 14 '22 at 17:56
  • In the end problem was in the organization network. It can be closed/deleted. – Zi Cold Jul 24 '22 at 20:08
  • Post and accept your own answer and then you can close the discussion. – Lex Li Jul 24 '22 at 20:16

1 Answers1

-1

After so many tries to overcome proxy in the end it was problem with organization network settings. Resolved with technical support help.

Zi Cold
  • 165
  • 8
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 28 '22 at 01:39