Wiremock: As IServer? #644

Closed
opened 2025-12-29 15:29:35 +01:00 by adam · 2 comments
Owner

Originally created by @AliWaja on GitHub (Nov 12, 2024).

Originally assigned to: @StefH on GitHub.

I want to be able to create a service that uses Wiremock as the actual server (overrides the default kestrel server), using something like UseServer shown here

Is this functionality already provided?
My only other option seems to be writing some middleware that parses the request to my service, copy the request data and pass it to Wiremock, then parses the Wiremock response into an HTTP response and returns...
Any recommendations?

Originally created by @AliWaja on GitHub (Nov 12, 2024). Originally assigned to: @StefH on GitHub. I want to be able to create a service that uses Wiremock as the actual server (overrides the default kestrel server), using something like UseServer shown [here](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.hostingabstractionswebhostbuilderextensions.useserver?view=aspnetcore-8.0#microsoft-aspnetcore-hosting-hostingabstractionswebhostbuilderextensions-useserver(microsoft-aspnetcore-hosting-iwebhostbuilder-microsoft-aspnetcore-hosting-server-iserver)) Is this functionality already provided? My only other option seems to be writing some middleware that parses the request to my service, copy the request data and pass it to Wiremock, then parses the Wiremock response into an HTTP response and returns... Any recommendations?
adam added the question label 2025-12-29 15:29:35 +01:00
adam closed this issue 2025-12-29 15:29:35 +01:00
Author
Owner

@StefH commented on GitHub (Nov 12, 2024):

I'm not 100% sure, but there is a middleware project (https://www.nuget.org/packages/WireMock.Net.AspNetCore.Middleware) which can be used to host WireMock.Net inside your running ASPNetCore server so that HTTP Requests going to a real API will be redirected to WireMock.Net

For an scenario see this project:
https://github.com/WireMock-Net/WireMock.Net/tree/master/test/WireMock.Net.TestWebApplication

And see this unit (integration) test:
https://github.com/WireMock-Net/WireMock.Net/tree/master/test/WireMock.Net.Middleware.Tests

@StefH commented on GitHub (Nov 12, 2024): I'm not 100% sure, but there is a middleware project (https://www.nuget.org/packages/WireMock.Net.AspNetCore.Middleware) which can be used to host WireMock.Net inside your running ASPNetCore server so that HTTP Requests going to a real API will be redirected to WireMock.Net For an scenario see this project: https://github.com/WireMock-Net/WireMock.Net/tree/master/test/WireMock.Net.TestWebApplication And see this unit (integration) test: https://github.com/WireMock-Net/WireMock.Net/tree/master/test/WireMock.Net.Middleware.Tests
Author
Owner

@AliWaja commented on GitHub (Nov 13, 2024):

Thanks, this helps!

@AliWaja commented on GitHub (Nov 13, 2024): Thanks, this helps!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#644