Windows-Containers icon indicating copy to clipboard operation
Windows-Containers copied to clipboard

Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a receive. on ServerCore:LTSC2022

Open GurdipS5 opened this issue 6 months ago • 4 comments

Hi, Not sure if this is a bug or what.

I am using the servercore LTSC 2022 docker image.

I run a command Invoke-RestMethod with BasicParsing and this works fine. This is to the url login.microsoftonline.com

However, I use the same cmdlet to dev.azure.com, but get:

Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a receive.

I have checked the container, and enabled TLS 1.2. There is nothing in the netwrok getting in the way.

Any suggestions?

GurdipS5 avatar Jun 23 '25 17:06 GurdipS5

Thank you for creating an Issue. Please note that GitHub is not an official channel for Microsoft support requests. To create an official support request, please open a ticket here. Microsoft and the GitHub Community strive to provide a best effort in answering questions and supporting Issues on GitHub.

github-actions[bot] avatar Jun 23 '25 17:06 github-actions[bot]

Hi,

I just did a quick test running a ServerCore LTSC2022 container image on a WS2022 host. (Both fully up to date, ex. build 20348.3932).

I launched the container as follows:

docker run --rm -it mcr.microsoft.com/windows/servercore:ltsc2022 powershell.exe

Within the container I ran each of the following commands:

Invoke-RestMethod -Uri login.microsoftonline.com Invoke-RestMethod -Uri dev.azure.com

And they both returned results without error.

I also applied the "-UseBasicParsing" argument and got similar results.

Invoke-RestMethod -UseBasicParsing -Uri login.microsoftonline.com Invoke-RestMethod -UseBasicParsing -Uri dev.azure.com

So, I don't seem to be able to repro the issue you were seeing. Can you tell us more about your repro case?

Thanks, Erick Smith (Microsoft)

fjs4 avatar Jul 15 '25 19:07 fjs4

This issue has been open for 30 days with no updates. @fjs4, please provide an update or close this issue.

This issue has been open for 30 days with no updates. @fjs4, please provide an update or close this issue.

This issue has been open for 30 days with no updates. @fjs4, please provide an update or close this issue.