mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
Feature: Support running WireMock.Net as a sub-app in IIS #114
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @DavidKorn on GitHub (Jun 28, 2018).
Is there an easy way to stand up WireMock.Net as a web app hosted on an internal IIS server? Our build & test pipeline pushes web apps to our various test environments, and it would make life a lot easier to deploy WireMock to those test environments in the same way. The goal would be to be able to hit
http://staging.ourCo.com/mock/whateverand have WireMock generate the response to the/whateverpath.Meanwhile
http://staging.ourCo.com/fancyappwould be a different site on the same IIS.@StefH commented on GitHub (Jun 28, 2018):
You can host WireMock.Net as a web-api, this is described at https://github.com/WireMock-Net/WireMock.Net/wiki/WireMock-as-a-(Azure)-Web-App.
Does this help you?
@DavidKorn commented on GitHub (Jul 1, 2018):
@StefH Thanks for the pointer! I really appreciate all the samples. I had had some circumstantial issues early on that led me astray, but that sample works for me in IIS once I got my kinks worked out.
I still have one related kink: I'm hosting WireMock as a sub app on IIS, but the sub app base directory is still prepending to the request and throwing off the matching. For example, the sub app is in
/mock, and if I hithttp://localhost/mock/__admin/settings, the request being matched is still/mock/__admin/settingsrather than/__admin/settings. I haven't yet tracked this down in the code, but I'm wondering if there is just some setting I need to set?@StefH commented on GitHub (Jul 1, 2018):
Currently it seems that WireMock.Net does not yet support running in a sub-app in IIS. The easiest solution would be that the sub-app folder name would be configured using the FluentMockServerSettings.
I'll take a look if I can build that.
Edit...
Actually the solution should cover two scenarios:
/test1and also at/test2. However I'm not 100% this will work.@StefH commented on GitHub (Jul 1, 2018):
Hello @DavidKorn ,
You can review branch https://github.com/WireMock-Net/WireMock.Net/tree/iis_fix which includes the fix + updated example.
And I've created a preview NuGet, please test this and give me feedback.
https://www.nuget.org/packages/WireMock.Net.StandAlone/1.0.4.5-preview-01
and
https://www.nuget.org/packages/WireMock.Net/1.0.4.5-preview-01
@DavidKorn commented on GitHub (Jul 1, 2018):
Thanks @StefH I'll take a look.
Edit: Removed pointless comment. I misunderstood your plan. :) I'll keep reviewing and testing but initially this looks great.
@DavidKorn commented on GitHub (Jul 2, 2018):
Nicely done @StefH . It works perfectly in all my local testing. I'll work with my devops in the next few days to get the preview rolled out and I'll report back if there's any surprises. Thanks again for all your work to get make this tool so great.
Minor thing: The readme.md in the sample web project references two publish profiles, but those are missing and probably getting git-ignored in your commits. (Even more minor: That csproj includes the wwwroot folder but it doesn't exist from the repo, so that looks a little broken in solution explorer.)
@DavidKorn commented on GitHub (Jul 2, 2018):
It looks like the AbsoluteUrl is wrong now. It doesn't include the subpath.
@StefH commented on GitHub (Jul 2, 2018):
Hello David,
1]
I've fixed the minors, see that same branch.
2]
I've fixed the AbsoluteUrl. So the request is now logged like:
I've also added the AbsolutePath, AbsoluteUrl and AbsolutePathSegments to the request, so they can also be used in the handlebars substitution.
3]
New NuGet is uploaded : 1.0.4.5-preview-02
@DavidKorn commented on GitHub (Jul 4, 2018):
Quick update: We are testing on 1.0.4.5 preview 2, and so far things continue to work well.
You mentioned fixing the minor issues, but I don't think the publish profiles referenced in the readme.md are working. For me those get git-ignored, maybe that's why.
@StefH commented on GitHub (Jul 4, 2018):
I thought that I did override the ignore... I will take a look, but this will be after some time. No access to code right now.
@DavidKorn commented on GitHub (Jul 10, 2018):
@StefH I think you can close this issue whenever you like. The main feature here is working great for us now.
@StefH commented on GitHub (Jul 10, 2018):
This weekend I'll see if the ignored files can be added to git. And I will create a official NuGet.