Can Wiremock listen on different URLs? #486

Closed
opened 2025-12-29 08:28:55 +01:00 by adam · 5 comments
Owner

Originally created by @chrisw11112 on GitHub (Feb 7, 2023).

Originally assigned to: @StefH on GitHub.

Thanks for any help! I'm trying to start a wiremock server with a url of http://ls-localhost:8080 but am getting a timeout error. Is This a valid use case?

This is my code

var settings = new WireMockServerSettings();
settings.Urls = new string[] { "http://ls-localhost:8080" };
settings.ReadStaticMappings = true;

var server = WireMockServer.Start(settings);

server.ReadStaticMappingAndAddOrUpdate("Mock.json");

I have a very specific use case for this and it needs to have the prefix to work correctly.

Thanks!

Originally created by @chrisw11112 on GitHub (Feb 7, 2023). Originally assigned to: @StefH on GitHub. Thanks for any help! I'm trying to start a wiremock server with a url of http://ls-localhost:8080 but am getting a timeout error. Is This a valid use case? This is my code ``` var settings = new WireMockServerSettings(); settings.Urls = new string[] { "http://ls-localhost:8080" }; settings.ReadStaticMappings = true; var server = WireMockServer.Start(settings); server.ReadStaticMappingAndAddOrUpdate("Mock.json"); ``` I have a very specific use case for this and it needs to have the prefix to work correctly. Thanks!
adam added the question label 2025-12-29 08:28:55 +01:00
adam closed this issue 2025-12-29 08:28:55 +01:00
Author
Owner

@StefH commented on GitHub (Feb 7, 2023):

I think this will only work if you define ls-localhost in the hostfile?

@StefH commented on GitHub (Feb 7, 2023): I think this will only work if you define `ls-localhost` in the hostfile?
Author
Owner

@chrisw11112 commented on GitHub (Feb 7, 2023):

Are you referring to the windows/linux host file are is there something I'm missing?

@chrisw11112 commented on GitHub (Feb 7, 2023): Are you referring to the windows/linux host file are is there something I'm missing?
Author
Owner

@StefH commented on GitHub (Feb 7, 2023):

Correct.

@StefH commented on GitHub (Feb 7, 2023): Correct.
Author
Owner

@chrisw11112 commented on GitHub (Feb 8, 2023):

Thanks for the super quick replies! Are there by any chance any plans to change that functionality and would you like me to close the thread?

@chrisw11112 commented on GitHub (Feb 8, 2023): Thanks for the super quick replies! Are there by any chance any plans to change that functionality and would you like me to close the thread?
Author
Owner

@StefH commented on GitHub (Feb 8, 2023):

Listening on multiple URL's can be done like this

string url1 = "http://localhost:9091/";
string url2 = "http://localhost:9092/";
string url3 = "https://localhost:9443/";

server = WireMockServer.Start(new WireMockServerSettings
{
    Urls = new[] { url1, url2, url3 }
});

However listening can only be done on localhost or an ip-address from the server where WireMock.Net is running.

@StefH commented on GitHub (Feb 8, 2023): Listening on multiple URL's can be done like this ``` c# string url1 = "http://localhost:9091/"; string url2 = "http://localhost:9092/"; string url3 = "https://localhost:9443/"; server = WireMockServer.Start(new WireMockServerSettings { Urls = new[] { url1, url2, url3 } }); ``` However listening can only be done on `localhost` or an ip-address from the server where WireMock.Net is running.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net#486