Listen on all ips
I ask this as question, maybe I missed something obvious.
When I want to listen to all public IPs I thought I could use http://0.0.0.0 as URL, but it was not working. So I had to get all my current IPs and add them as List.
And when I check this line of code:
https://github.com/WireMock-Net/WireMock.Net/blob/master/src/WireMock.Net/Owin/AspNetCoreSelfHost.NETStandard.cs#L79
it looks like it should use "ListenAnyIP" but instead it is listed in "ListenLocalhost"?
I need to double check that.
BTW what .NET version are you using?
I usually use .net 8 now.
I tried it and moved the host check for 0.0.0.0 at top and return it as ListenAnyIP and it works:
if (urlDetail is { Port: > 0, Host: "0.0.0.0" })
{
kestrelOptions.ListenAnyIP(urlDetail.Port, configure);
return;
}
var Settings = new WireMock.Settings.WireMockServerSettings
{
Urls = new string[] { "http://0.0.0.0:80" },
AllowPartialMapping = true,
StartAdminInterface = true,
};
var server = WireMockServer.Start(Settings);
Looks good.
Can you make a PR and if possible add/update a unit test?
PR created and tried to add a test.