diff --git a/WireMock.Net Solution.sln b/WireMock.Net Solution.sln
index 3cbec0aa..3c05bd3e 100644
--- a/WireMock.Net Solution.sln
+++ b/WireMock.Net Solution.sln
@@ -49,6 +49,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.Proxy.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.StandAlone.Net461", "examples\WireMock.Net.StandAlone.Net461\WireMock.Net.StandAlone.Net461.csproj", "{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Service", "examples\Wiremock.Net.Service\WireMock.Net.Service.csproj", "{7F0B2446-0363-4720-AF46-F47F83B557DC}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -107,6 +109,10 @@ Global
{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7F0B2446-0363-4720-AF46-F47F83B557DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7F0B2446-0363-4720-AF46-F47F83B557DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7F0B2446-0363-4720-AF46-F47F83B557DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7F0B2446-0363-4720-AF46-F47F83B557DC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -125,6 +131,7 @@ Global
{26433A8F-BF01-4962-97EB-81BFFBB61096} = {F0C22C47-DF71-463C-9B04-B4E0F3B8708A}
{23A9AA3C-40FC-42AA-8A5E-05899795A1C6} = {F0C22C47-DF71-463C-9B04-B4E0F3B8708A}
{3C279524-DB73-4DE3-BEF1-F2B2958C9F65} = {F0C22C47-DF71-463C-9B04-B4E0F3B8708A}
+ {7F0B2446-0363-4720-AF46-F47F83B557DC} = {F0C22C47-DF71-463C-9B04-B4E0F3B8708A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BF428BCC-C837-433B-87D2-15C7014B73E9}
diff --git a/examples/WireMock.Net.Service/App.config b/examples/WireMock.Net.Service/App.config
new file mode 100644
index 00000000..443afce1
--- /dev/null
+++ b/examples/WireMock.Net.Service/App.config
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/WireMock.Net.Service/InstallUtil.InstallLog b/examples/WireMock.Net.Service/InstallUtil.InstallLog
new file mode 100644
index 00000000..a77f9685
--- /dev/null
+++ b/examples/WireMock.Net.Service/InstallUtil.InstallLog
@@ -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.
diff --git a/examples/WireMock.Net.Service/Installer.Designer.cs b/examples/WireMock.Net.Service/Installer.Designer.cs
new file mode 100644
index 00000000..765a9058
--- /dev/null
+++ b/examples/WireMock.Net.Service/Installer.Designer.cs
@@ -0,0 +1,59 @@
+namespace Wiremock.Net.Service
+{
+ partial class Installer
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
+ this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
+ //
+ // serviceProcessInstaller1
+ //
+ this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
+ this.serviceProcessInstaller1.Password = null;
+ this.serviceProcessInstaller1.Username = null;
+ //
+ // serviceInstaller1
+ //
+ this.serviceInstaller1.Description = "WireMock.Net Service";
+ this.serviceInstaller1.DisplayName = "WireMock.Net.Service";
+ this.serviceInstaller1.ServiceName = "WireMock.Net.Service";
+ this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
+ //
+ // ProjectInstaller
+ //
+ this.Installers.AddRange(new System.Configuration.Install.Installer[] {
+ this.serviceProcessInstaller1,
+ this.serviceInstaller1});
+ }
+
+ #endregion
+
+ private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;
+ private System.ServiceProcess.ServiceInstaller serviceInstaller1;
+ }
+}
\ No newline at end of file
diff --git a/examples/WireMock.Net.Service/Installer.cs b/examples/WireMock.Net.Service/Installer.cs
new file mode 100644
index 00000000..5e9840a9
--- /dev/null
+++ b/examples/WireMock.Net.Service/Installer.cs
@@ -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();
+ }
+ }
+}
diff --git a/examples/WireMock.Net.Service/Program.cs b/examples/WireMock.Net.Service/Program.cs
new file mode 100644
index 00000000..d7637493
--- /dev/null
+++ b/examples/WireMock.Net.Service/Program.cs
@@ -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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/WireMock.Net.Service/Properties/AssemblyInfo.cs b/examples/WireMock.Net.Service/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..75fd5676
--- /dev/null
+++ b/examples/WireMock.Net.Service/Properties/AssemblyInfo.cs
@@ -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")]
diff --git a/examples/WireMock.Net.Service/Service-Install.bat b/examples/WireMock.Net.Service/Service-Install.bat
new file mode 100644
index 00000000..d6064bf1
--- /dev/null
+++ b/examples/WireMock.Net.Service/Service-Install.bat
@@ -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"
\ No newline at end of file
diff --git a/examples/WireMock.Net.Service/Service-Start.bat b/examples/WireMock.Net.Service/Service-Start.bat
new file mode 100644
index 00000000..4909359e
--- /dev/null
+++ b/examples/WireMock.Net.Service/Service-Start.bat
@@ -0,0 +1,3 @@
+@echo off
+
+net start "WireMock.Net.Service"
\ No newline at end of file
diff --git a/examples/WireMock.Net.Service/Service-Stop.bat b/examples/WireMock.Net.Service/Service-Stop.bat
new file mode 100644
index 00000000..f6f24c9f
--- /dev/null
+++ b/examples/WireMock.Net.Service/Service-Stop.bat
@@ -0,0 +1,3 @@
+@echo off
+
+net stop "WireMock.Net.Service"
\ No newline at end of file
diff --git a/examples/WireMock.Net.Service/Service-Uninstall.bat b/examples/WireMock.Net.Service/Service-Uninstall.bat
new file mode 100644
index 00000000..238d7ac9
--- /dev/null
+++ b/examples/WireMock.Net.Service/Service-Uninstall.bat
@@ -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%"
\ No newline at end of file
diff --git a/examples/WireMock.Net.Service/WireMock.Net.Service.csproj b/examples/WireMock.Net.Service/WireMock.Net.Service.csproj
new file mode 100644
index 00000000..f342b96a
--- /dev/null
+++ b/examples/WireMock.Net.Service/WireMock.Net.Service.csproj
@@ -0,0 +1,127 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {7F0B2446-0363-4720-AF46-F47F83B557DC}
+ Exe
+ WireMock.Net.Service
+ WireMock.Net.Service
+ v4.5.2
+ 512
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\..\packages\Handlebars.Net.1.9.0\lib\net40\Handlebars.dll
+
+
+ ..\..\packages\Microsoft.Owin.2.0.2\lib\net45\Microsoft.Owin.dll
+
+
+ ..\..\packages\Microsoft.Owin.Host.HttpListener.2.0.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll
+
+
+ ..\..\packages\Microsoft.Owin.Hosting.2.0.2\lib\net45\Microsoft.Owin.Hosting.dll
+
+
+ ..\..\packages\MimeKitLite.2.0.1\lib\net45\MimeKitLite.dll
+
+
+ ..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll
+
+
+ ..\..\packages\Owin.1.0\lib\net40\Owin.dll
+
+
+ ..\..\packages\RestEase.1.4.4\lib\net45\RestEase.dll
+
+
+ ..\..\packages\SimMetrics.Net.1.0.4\lib\net45\SimMetrics.Net.dll
+
+
+
+
+
+
+ ..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll
+
+
+
+
+
+
+
+ ..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll
+
+
+ ..\..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll
+
+
+
+
+
+
+
+
+ ..\..\packages\XPath2.1.0.5.1\lib\net40\XPath2.dll
+
+
+
+
+ Component
+
+
+ Installer.cs
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+
+
+
+ {b6269aac-170a-43d5-8b9a-579ded3d9a95}
+ WireMock.Net.StandAlone
+
+
+ {d3804228-91f4-4502-9595-39584e5a01ad}
+ WireMock.Net
+
+
+
+
\ No newline at end of file
diff --git a/examples/WireMock.Net.Service/packages.config b/examples/WireMock.Net.Service/packages.config
new file mode 100644
index 00000000..1303aadd
--- /dev/null
+++ b/examples/WireMock.Net.Service/packages.config
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/WireMock.Net.StandAlone/StandAloneApp.cs b/src/WireMock.Net.StandAlone/StandAloneApp.cs
index de6bf4ba..6e696214 100644
--- a/src/WireMock.Net.StandAlone/StandAloneApp.cs
+++ b/src/WireMock.Net.StandAlone/StandAloneApp.cs
@@ -21,7 +21,11 @@ namespace WireMock.Net.StandAlone
{
Check.NotNull(settings, nameof(settings));
- return FluentMockServer.Start(settings);
+ var server = FluentMockServer.Start(settings);
+
+ settings.Logger.Info("WireMock.Net server listening at {0}", string.Join(",", server.Urls));
+
+ return server;
}
///
@@ -80,8 +84,6 @@ namespace WireMock.Net.StandAlone
FluentMockServer server = Start(settings);
- settings.Logger.Info("WireMock.Net server listening at {0}", string.Join(",", server.Urls));
-
return server;
}
}