Hang possibly due to Windows firewall prompt #106

Closed
opened 2025-12-29 14:22:36 +01:00 by adam · 4 comments
Owner

Originally created by @alexangas on GitHub (May 29, 2018).

Hello again 😃

Unfortunately after this change to PortUtil.cs introduced in WireMock.Net 1.0.3.19, the behaviour has changed which is causing some issues.

When trying to use this version on our build server, unit tests that use WireMock hang as soon as their execution commences. I noticed when running them on my dev machine that I was now prompted by Windows Firewall to grant dotnet.exe extra permissions. So my guess is that this same prompt is happening on the build server which we don't have access to.

I tried a couple of things which seem to have fixed the issue on my dev machine, but may well cause problems for others! Without a NuGet package (pre-release would do) I can't test on the build servers.

  1. In PortUtil.cs line 21, changed AddressFamily.InterNetwork to DefaultLoopbackEndpoint.AddressFamily
  2. In AspNetCoreSelfHost.cs lines 79 and 85, changed System.Net.IPAddress.Any to System.Net.IPAddress.Loopback

What are your thoughts?

Originally created by @alexangas on GitHub (May 29, 2018). Hello again 😃 Unfortunately after [this change to PortUtil.cs](https://github.com/WireMock-Net/WireMock.Net/blob/a9e6064422dc77bfdd27e813c5bd501dc28eef21/src/WireMock.Net/Http/PortUtil.cs) introduced in WireMock.Net 1.0.3.19, the behaviour has changed which is causing some issues. When trying to use this version on our build server, unit tests that use WireMock hang as soon as their execution commences. I noticed when running them on my dev machine that I was now prompted by Windows Firewall to grant dotnet.exe extra permissions. So my guess is that this same prompt is happening on the build server which we don't have access to. I tried a couple of things which seem to have fixed the issue on my dev machine, but may well cause problems for others! Without a NuGet package (pre-release would do) I can't test on the build servers. 1. In PortUtil.cs line 21, changed `AddressFamily.InterNetwork` to `DefaultLoopbackEndpoint.AddressFamily` 2. In AspNetCoreSelfHost.cs lines 79 and 85, changed `System.Net.IPAddress.Any` to `System.Net.IPAddress.Loopback` What are your thoughts?
adam closed this issue 2025-12-29 14:22:37 +01:00
Author
Owner

@StefH commented on GitHub (May 29, 2018):

Hello Alex,

I'll revert back the code for point 1.

About point 2 ; this was not changed by me I guess in the last checkin?

@StefH commented on GitHub (May 29, 2018): Hello Alex, I'll revert back the code for point 1. About point 2 ; this was not changed by me I guess in the last checkin?
Author
Owner

@alexangas commented on GitHub (May 29, 2018):

Sorry for not being clear - those points 1 and 2 are things I changed to try and fix this issue based off the WireMock 1.0.3.19 release. It seemed to do it, but i'm not sure if it has unintended site effects.

@alexangas commented on GitHub (May 29, 2018): Sorry for not being clear - those points 1 and 2 are things I changed to try and fix this issue based off the WireMock 1.0.3.19 release. It seemed to do it, but i'm not sure if it has unintended site effects.
Author
Owner

@StefH commented on GitHub (May 29, 2018):

For now I'll revert back the code for point 1, I've created a PR for that.
About point 2, this did work for me, so for now, I'll keep that code. In case a change is needed, please create a new issue or PR with some code to reproduce if possible.

@StefH commented on GitHub (May 29, 2018): For now I'll revert back the code for point 1, I've created a PR for that. About point 2, this did work for me, so for now, I'll keep that code. In case a change is needed, please create a new issue or PR with some code to reproduce if possible.
Author
Owner

@StefH commented on GitHub (May 29, 2018):

For now I close this one.

@StefH commented on GitHub (May 29, 2018): For now I close this one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#106