-
-
Notifications
You must be signed in to change notification settings - Fork 211
WireMock as a (Azure) Web App
Stef Heyenrath edited this page Jan 22, 2021
·
10 revisions
It's also possible to run WireMock as a Web-Application on Azure or IIS.
See this code example how a App-Service could look:
public class WireMockService : IWireMockService
{
private static int sleepTime = 30000;
private readonly ILogger _logger;
private readonly IWireMockServerSettings _settings;
private class Logger : IWireMockLogger
{
// Implement all methods from the IWireMockLogger here ...
}
public WireMockService(ILogger logger, IWireMockServerSettings settings)
{
_logger = logger;
_settings = settings;
_settings.Logger = new Logger(logger);
}
public void Run()
{
_logger.LogInformation("WireMock.Net server starting");
StandAloneApp.Start(_settings);
_logger.LogInformation($"WireMock.Net server settings {JsonConvert.SerializeObject(_settings)}");
while (true)
{
_logger.LogInformation("WireMock.Net server running");
Thread.Sleep(sleepTime);
}
}
}
For a full working example, see examples\WireMock.Net.WebApplication.NETCore3
- Home
- What is WireMock.Net
- WireMock.Org
- References
- Settings
- Admin REST API
- Proxying
- Stubbing
- Webhook
- Request Matching
- Response Templating
- Unit Testing
- Using WireMock
- Advanced
- Errors