Unable to mock requests to specified url #396

Closed
opened 2025-12-29 08:27:22 +01:00 by adam · 2 comments
Owner

Originally created by @Yedidyah27 on GitHub (Dec 29, 2021).

Describe the bug

I am trying to set up wiremock for substituting responses for http requests made during testing. When I start the wiremock server I initialize it with a specific url it should intercept. I can see in debug that the wiremock server ignores the url I provided and connects to a random localhost port.

Very simple code snippet:

var url = "https://test." + env + ".com";
_server = WireMockServer.Start(url);

I am expecting the wiremock server to intercept requests made to the url I specified but it doesnt.

Am I missing anything?

(project is using .net5)

Originally created by @Yedidyah27 on GitHub (Dec 29, 2021). ### Describe the bug I am trying to set up wiremock for substituting responses for http requests made during testing. When I start the wiremock server I initialize it with a specific url it should intercept. I can see in debug that the wiremock server ignores the url I provided and connects to a random localhost port. Very simple code snippet: ``` c# var url = "https://test." + env + ".com"; _server = WireMockServer.Start(url); ``` I am expecting the wiremock server to intercept requests made to the url I specified but it doesnt. Am I missing anything? (project is using .net5)
adam added the question label 2025-12-29 08:27:22 +01:00
adam closed this issue 2025-12-29 08:27:22 +01:00
Author
Owner

@StefH commented on GitHub (Dec 29, 2021):

Hello @Yedidyah27,

WireMock.Net cannot just listen to that URL.

You need to start WireMock.Net on https://localhost:80443 for example.

And then you need to make sure that you connect from your client application to that https://localhost:80443 url.

@StefH commented on GitHub (Dec 29, 2021): Hello @Yedidyah27, WireMock.Net cannot just listen to that URL. You need to start WireMock.Net on https://localhost:80443 for example. And then you need to make sure that you connect from your client application to that https://localhost:80443 url.
Author
Owner

@Yedidyah27 commented on GitHub (Dec 29, 2021):

Got it thanks

@Yedidyah27 commented on GitHub (Dec 29, 2021): Got it thanks
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net#396