-
-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
412 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> | ||
</startup> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
| ||
|
||
The uninstall is beginning. | ||
See the contents of the log file for the C:\Users\azureuser\Documents\Github\WireMock.Net\examples\Wiremock.Net.Service\bin\debug\Wiremock.Net.Service.exe assembly's progress. | ||
The file is located at C:\Users\azureuser\Documents\Github\WireMock.Net\examples\Wiremock.Net.Service\bin\debug\Wiremock.Net.Service.InstallLog. | ||
|
||
The uninstall has completed. | ||
|
||
|
||
The uninstall is beginning. | ||
See the contents of the log file for the C:\Users\azureuser\Documents\Github\WireMock.Net\examples\Wiremock.Net.Service\bin\debug\Wiremock.Net.Service.exe assembly's progress. | ||
The file is located at C:\Users\azureuser\Documents\Github\WireMock.Net\examples\Wiremock.Net.Service\bin\debug\Wiremock.Net.Service.InstallLog. | ||
|
||
The uninstall has completed. | ||
|
||
|
||
The uninstall is beginning. | ||
See the contents of the log file for the C:\Users\azureuser\Documents\Github\WireMock.Net\examples\Wiremock.Net.Service\bin\debug\Wiremock.Net.Service.exe assembly's progress. | ||
The file is located at C:\Users\azureuser\Documents\Github\WireMock.Net\examples\Wiremock.Net.Service\bin\debug\Wiremock.Net.Service.InstallLog. | ||
|
||
The uninstall has completed. | ||
|
||
|
||
The uninstall is beginning. | ||
See the contents of the log file for the C:\Users\azureuser\Documents\Github\WireMock.Net\examples\Wiremock.Net.Service\bin\debug\WireMock.Net.Service.exe assembly's progress. | ||
The file is located at C:\Users\azureuser\Documents\Github\WireMock.Net\examples\Wiremock.Net.Service\bin\debug\WireMock.Net.Service.InstallLog. | ||
|
||
The uninstall has completed. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Configuration.Install; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Wiremock.Net.Service | ||
{ | ||
[RunInstaller(true)] | ||
public partial class Installer : System.Configuration.Install.Installer | ||
{ | ||
public Installer() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
using System; | ||
using System.ServiceProcess; | ||
using WireMock.Logging; | ||
using WireMock.Net.StandAlone; | ||
using WireMock.Server; | ||
using WireMock.Settings; | ||
|
||
namespace Wiremock.Net.Service | ||
{ | ||
public static class Program | ||
{ | ||
#region Nested classes to support running as service | ||
public const string ServiceName = "Wiremock.Net.Service"; | ||
|
||
public class Service : ServiceBase | ||
{ | ||
public Service() | ||
{ | ||
ServiceName = Program.ServiceName; | ||
} | ||
|
||
protected override void OnStart(string[] args) | ||
{ | ||
Start(); | ||
} | ||
|
||
protected override void OnStop() | ||
{ | ||
Program.Stop(); | ||
} | ||
} | ||
#endregion | ||
|
||
private static FluentMockServer _server; | ||
|
||
static void Main(string[] args) | ||
{ | ||
// running as service | ||
if (!Environment.UserInteractive) | ||
{ | ||
using (var service = new Service()) | ||
{ | ||
ServiceBase.Run(service); | ||
} | ||
} | ||
else | ||
{ | ||
// running as console app | ||
Start(); | ||
|
||
Console.WriteLine("Press any key to stop..."); | ||
Console.ReadKey(true); | ||
|
||
Stop(); | ||
} | ||
} | ||
|
||
private static void Start() | ||
{ | ||
_server = StandAloneApp.Start(new FluentMockServerSettings | ||
{ | ||
Urls = new[] { "http://*:9091/" }, | ||
StartAdminInterface = true, | ||
ReadStaticMappings = true, | ||
Logger = new WireMockConsoleLogger() | ||
}); | ||
} | ||
|
||
private static void Stop() | ||
{ | ||
_server.Stop(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("Wiremock.Net.Service")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("Wiremock.Net.Service")] | ||
[assembly: AssemblyCopyright("Copyright © Stef Heyenrath 2018")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("7f0b2446-0363-4720-af46-f47f83b557dc")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@echo off | ||
call uninstall.bat | ||
|
||
SET mypath=%~dp0 | ||
SET targetpath=C:\Services\WireMock.Net.Service\ | ||
|
||
mkdir "%targetpath%" | ||
xcopy "%mypath%*" "%targetpath%*" | ||
|
||
C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe "%targetpath%WireMock.Net.Service.exe" | ||
net start "WireMock.Net.Service" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@echo off | ||
|
||
net start "WireMock.Net.Service" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@echo off | ||
|
||
net stop "WireMock.Net.Service" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@echo off | ||
SET mypath=%~dp0 | ||
SET targetpath=C:\Services\WireMock.Net.Service\ | ||
|
||
net stop "WireMock.Net.Service" | ||
C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe /u "%mypath%WireMock.Net.Service.exe" | ||
sc delete "WireMock.Net.Service" | ||
|
||
rmdir /S /Q "%targetpath%" |
Oops, something went wrong.