Scheduler moved into windows service.

This commit is contained in:
vfedosevich 2013-05-03 17:29:25 +03:00
parent 5e414136b2
commit ce95326f7d
15 changed files with 219 additions and 86 deletions

View file

@ -28,6 +28,9 @@
using System;
using System.Collections.Generic;
using System.Configuration.Install;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.IO;
using System.Xml;
@ -99,6 +102,74 @@ namespace WebsitePanel.Setup.Actions
}
}
public class InstallSchedulerServiceAction : Action, IInstallAction, IUninstallAction
{
public const string LogStartInstallMessage = "Installing Scheduler Windows Service...";
public const string LogStartUninstallMessage = "Uninstalling Scheduler Windows Service...";
void IInstallAction.Run(SetupVariables vars)
{
try
{
Begin(LogStartInstallMessage);
Log.WriteStart(LogStartInstallMessage);
Log.WriteInfo(String.Format("Scheduler Service Name: \"{0}\"", Global.Parameters.SchedulerServiceName));
if (ServiceController.GetServices().Any(s => s.DisplayName.Equals(Global.Parameters.SchedulerServiceName, StringComparison.CurrentCultureIgnoreCase)))
{
Log.WriteEnd("Scheduler Service Already Installed.");
InstallLog.AppendLine(String.Format("- Scheduler Service \"{0}\" Already Installed.", Global.Parameters.SchedulerServiceName));
return;
}
ManagedInstallerClass.InstallHelper(new[] {"/i", Path.Combine(vars.InstallationFolder, "bin", Global.Parameters.SchedulerServiceFileName)});
Utils.StartService(Global.Parameters.SchedulerServiceName);
}
catch (Exception ex)
{
UninstallService(vars);
if (Utils.IsThreadAbortException(ex))
{
return;
}
Log.WriteError("Installing scheduler service error.", ex);
throw;
}
}
void IUninstallAction.Run(SetupVariables vars)
{
try
{
Log.WriteStart(LogStartUninstallMessage);
UninstallService(vars);
Log.WriteEnd("Scheduler Service Uninstalled.");
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
{
return;
}
Log.WriteError("Uninstalling scheduler service error.", ex);
throw;
}
}
private void UninstallService(SetupVariables vars)
{
if (ServiceController.GetServices().Any(s => s.ServiceName.Equals(Global.Parameters.SchedulerServiceName, StringComparison.CurrentCultureIgnoreCase)))
{
ManagedInstallerClass.InstallHelper(new[] { "/u", Path.Combine(vars.InstallationFolder, "bin", Global.Parameters.SchedulerServiceFileName) });
}
}
}
public class CreateDatabaseAction : Action, IInstallAction, IUninstallAction
{
public const string LogStartInstallMessage = "Creating SQL Server database...";
@ -348,6 +419,31 @@ namespace WebsitePanel.Setup.Actions
}
}
public class SaveSchedulerServiceConnectionStringAction : Action, IInstallAction
{
void IInstallAction.Run(SetupVariables vars)
{
Log.WriteStart(string.Format("Updating {0}.config file (connection string)", Global.Parameters.SchedulerServiceFileName));
var file = Path.Combine(vars.InstallationFolder, "bin", string.Format("{0}.config", Global.Parameters.SchedulerServiceFileName));
string content;
using (var reader = new StreamReader(file))
{
content = reader.ReadToEnd();
}
vars.ConnectionString = String.Format(vars.ConnectionString, vars.DatabaseServer, vars.Database, vars.Database, vars.DatabaseUserPassword);
content = Utils.ReplaceScriptVariable(content, "installer.connectionstring", vars.ConnectionString);
using (var writer = new StreamWriter(file))
{
writer.Write(content);
}
Log.WriteEnd(string.Format("Updated {0}.config file (connection string)", Global.Parameters.SchedulerServiceFileName));
}
}
public class SaveEntServerConfigSettingsAction : Action, IInstallAction
{
void IInstallAction.Run(SetupVariables vars)
@ -390,7 +486,9 @@ namespace WebsitePanel.Setup.Actions
new UpdateServeradminPasswAction(),
new SaveAspNetDbConnectionStringAction(),
new SaveComponentConfigSettingsAction(),
new SaveEntServerConfigSettingsAction()
new SaveEntServerConfigSettingsAction(),
new SaveSchedulerServiceConnectionStringAction(),
new InstallSchedulerServiceAction()
};
public EntServerActionManager(SetupVariables sessionVars) : base(sessionVars)

View file

@ -77,6 +77,8 @@ namespace WebsitePanel.Setup
public const string ConnectionString = "ConnectionString";
public const string InstallConnectionString = "InstallConnectionString";
public const string Release = "Release";
public const string SchedulerServiceFileName = "WebsitePanel.SchedulerService.exe";
public const string SchedulerServiceName = "WebsitePanel Scheduler";
}
public abstract class Messages

View file

@ -74,6 +74,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Drawing" />

View file

@ -27,11 +27,14 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Configuration.Install;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.Windows.Forms;
@ -208,17 +211,19 @@ namespace WebsitePanel.Setup
Log.WriteError("Windows service stop error", ex);
}
int exitCode = Utils.RunProcess(path, "/u");
if (exitCode == 0)
{
Log.WriteEnd("Removed Windows service");
InstallLog.AppendLine(string.Format("- Removed \"{0}\" Windows service", serviceName));
}
else
{
Log.WriteError(string.Format("Unable to remove \"{0}\" Windows service. Error code: {1}", serviceName, exitCode), null);
InstallLog.AppendLine(string.Format("- Failed to remove \"{0}\" Windows service", serviceName));
}
try
{
ManagedInstallerClass.InstallHelper(new[] {"/u", path});
}
catch(Exception)
{
Log.WriteError(string.Format("Unable to remove \"{0}\" Windows service.", serviceName), null);
InstallLog.AppendLine(string.Format("- Failed to remove \"{0}\" Windows service", serviceName));
throw;
}
Log.WriteEnd("Removed Windows service");
InstallLog.AppendLine(string.Format("- Removed \"{0}\" Windows service", serviceName));
}
catch (Exception ex)
{
@ -268,7 +273,7 @@ namespace WebsitePanel.Setup
internal List<InstallAction> GetUninstallActions(string componentId)
{
List<InstallAction> list = new List<InstallAction>();
var list = new List<InstallAction>();
InstallAction action = null;
//windows service
@ -285,6 +290,12 @@ namespace WebsitePanel.Setup
list.Add(action);
}
if (ServiceController.GetServices().Any(s => s.DisplayName.Equals(Global.Parameters.SchedulerServiceName, StringComparison.CurrentCultureIgnoreCase)))
{
action = new InstallAction(ActionTypes.UnregisterWindowsService) {Path = Path.Combine(installFolder, "bin", Global.Parameters.SchedulerServiceFileName), Name = Global.Parameters.SchedulerServiceName, Description = "Removing Windows service..."};
action.Log = string.Format("- Remove {0} Windows service", action.Name);
list.Add(action);
}
//database
bool deleteDatabase = AppConfig.GetComponentSettingBooleanValue(componentId, "NewDatabase");

View file

@ -74,6 +74,9 @@
<Reference Include="WebsitePanel.EnterpriseServer.Client">
<HintPath>..\..\..\Bin\WebsitePanel.EnterpriseServer.Client.dll</HintPath>
</Reference>
<Reference Include="WebsitePanel.EnterpriseServer.Code">
<HintPath>..\..\..\Bin\WebsitePanel.EnterpriseServer.Code.dll</HintPath>
</Reference>
<Reference Include="WebsitePanel.Providers.Base">
<HintPath>..\..\..\Bin\WebsitePanel.Providers.Base.dll</HintPath>
</Reference>

View file

@ -17,7 +17,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>..\..\Bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@ -52,7 +52,8 @@
<Reference Include="WebsitePanel.Common.Utils">
<HintPath>..\..\Bin\WebsitePanel.Common.Utils.dll</HintPath>
</Reference>
<Reference Include="WebsitePanel.EnterpriseServer.Base">
<Reference Include="WebsitePanel.EnterpriseServer.Base, Version=2.1.0.1, Culture=neutral, PublicKeyToken=da8782a6fc4d0081, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Bin\WebsitePanel.EnterpriseServer.Base.dll</HintPath>
</Reference>
<Reference Include="WebsitePanel.EnterpriseServer.Client">

View file

@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2010
# Visual Studio 2012
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C57D3F9F-7BA0-4D38-A159-B6EDA5C19B13}"
ProjectSection(SolutionItems) = preProject
..\..\LICENSE.txt = ..\..\LICENSE.txt
@ -10,6 +10,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.EnterpriseServer", "WebsitePanel.EnterpriseServer\WebsitePanel.EnterpriseServer.csproj", "{59C7623A-5181-48A5-880A-C9B82B48F589}"
ProjectSection(ProjectDependencies) = postProject
{C09CE910-F16B-48A1-B2CC-C99B8C1CF775} = {C09CE910-F16B-48A1-B2CC-C99B8C1CF775}
{60E39314-659C-4FAD-AB91-D0D08E223578} = {60E39314-659C-4FAD-AB91-D0D08E223578}
{4B344644-A570-477E-ADCC-F2B267D6C038} = {4B344644-A570-477E-ADCC-F2B267D6C038}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.EnterpriseServer.Base", "WebsitePanel.EnterpriseServer.Base\WebsitePanel.EnterpriseServer.Base.csproj", "{C09CE910-F16B-48A1-B2CC-C99B8C1CF775}"
EndProject
@ -21,12 +26,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Plugins.Author
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Plugins.PayPalPro", "WebsitePanel.Gateways.PayPal\WebsitePanel.Plugins.PayPalPro.csproj", "{D695D58C-99F7-409E-B3D8-C1B97A8E748A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Products.DomainName", "WebsitePanel.Products.DomainName\WebsitePanel.Products.DomainName.csproj", "{FFE9BFD3-AAB8-4703-AF8F-A41F0D878DB8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Products.HostingAddon", "WebsitePanel.Products.HostingAddon\WebsitePanel.Products.HostingAddon.csproj", "{338F816B-BEB4-4F18-9EA1-2EFD35DBA65B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Products.HostingPlan", "WebsitePanel.Products.HostingPlan\WebsitePanel.Products.HostingPlan.csproj", "{65FEDD1B-379C-413D-84D8-20E6C29C645D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Plugins.Enom", "WebsitePanel.Registrars.Enom\WebsitePanel.Plugins.Enom.csproj", "{39A6F585-4A27-4AAA-A43F-858FC32ADF98}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Common.Utils", "WebsitePanel.Common.Utils\WebsitePanel.Common.Utils.csproj", "{53D22D35-4013-415F-BA09-F67A0DBBB0C1}"
@ -42,6 +41,9 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Templates", "WebsitePanel.Templates\WebsitePanel.Templates.csproj", "{387FA0EF-3927-45FF-8F8F-BCCD735540C6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.EnterpriseServer.Code", "WebsitePanel.EnterpriseServer.Code\WebsitePanel.EnterpriseServer.Code.csproj", "{60E39314-659C-4FAD-AB91-D0D08E223578}"
ProjectSection(ProjectDependencies) = postProject
{C09CE910-F16B-48A1-B2CC-C99B8C1CF775} = {C09CE910-F16B-48A1-B2CC-C99B8C1CF775}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.SchedulerService", "WebsitePanel.SchedulerService\WebsitePanel.SchedulerService.csproj", "{5B823520-0450-44A9-AC86-9658B41DFA7C}"
EndProject
@ -115,30 +117,6 @@ Global
{D695D58C-99F7-409E-B3D8-C1B97A8E748A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D695D58C-99F7-409E-B3D8-C1B97A8E748A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D695D58C-99F7-409E-B3D8-C1B97A8E748A}.Release|x86.ActiveCfg = Release|Any CPU
{FFE9BFD3-AAB8-4703-AF8F-A41F0D878DB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FFE9BFD3-AAB8-4703-AF8F-A41F0D878DB8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FFE9BFD3-AAB8-4703-AF8F-A41F0D878DB8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{FFE9BFD3-AAB8-4703-AF8F-A41F0D878DB8}.Debug|x86.ActiveCfg = Debug|Any CPU
{FFE9BFD3-AAB8-4703-AF8F-A41F0D878DB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FFE9BFD3-AAB8-4703-AF8F-A41F0D878DB8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{FFE9BFD3-AAB8-4703-AF8F-A41F0D878DB8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{FFE9BFD3-AAB8-4703-AF8F-A41F0D878DB8}.Release|x86.ActiveCfg = Release|Any CPU
{338F816B-BEB4-4F18-9EA1-2EFD35DBA65B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{338F816B-BEB4-4F18-9EA1-2EFD35DBA65B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{338F816B-BEB4-4F18-9EA1-2EFD35DBA65B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{338F816B-BEB4-4F18-9EA1-2EFD35DBA65B}.Debug|x86.ActiveCfg = Debug|Any CPU
{338F816B-BEB4-4F18-9EA1-2EFD35DBA65B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{338F816B-BEB4-4F18-9EA1-2EFD35DBA65B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{338F816B-BEB4-4F18-9EA1-2EFD35DBA65B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{338F816B-BEB4-4F18-9EA1-2EFD35DBA65B}.Release|x86.ActiveCfg = Release|Any CPU
{65FEDD1B-379C-413D-84D8-20E6C29C645D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{65FEDD1B-379C-413D-84D8-20E6C29C645D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{65FEDD1B-379C-413D-84D8-20E6C29C645D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{65FEDD1B-379C-413D-84D8-20E6C29C645D}.Debug|x86.ActiveCfg = Debug|Any CPU
{65FEDD1B-379C-413D-84D8-20E6C29C645D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{65FEDD1B-379C-413D-84D8-20E6C29C645D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{65FEDD1B-379C-413D-84D8-20E6C29C645D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{65FEDD1B-379C-413D-84D8-20E6C29C645D}.Release|x86.ActiveCfg = Release|Any CPU
{39A6F585-4A27-4AAA-A43F-858FC32ADF98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39A6F585-4A27-4AAA-A43F-858FC32ADF98}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39A6F585-4A27-4AAA-A43F-858FC32ADF98}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@ -220,13 +198,13 @@ Global
{60E39314-659C-4FAD-AB91-D0D08E223578}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{60E39314-659C-4FAD-AB91-D0D08E223578}.Release|x86.ActiveCfg = Release|Any CPU
{5B823520-0450-44A9-AC86-9658B41DFA7C}.Debug|Any CPU.ActiveCfg = Debug|x86
{5B823520-0450-44A9-AC86-9658B41DFA7C}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{5B823520-0450-44A9-AC86-9658B41DFA7C}.Debug|Mixed Platforms.Build.0 = Debug|x86
{5B823520-0450-44A9-AC86-9658B41DFA7C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{5B823520-0450-44A9-AC86-9658B41DFA7C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{5B823520-0450-44A9-AC86-9658B41DFA7C}.Debug|x86.ActiveCfg = Debug|x86
{5B823520-0450-44A9-AC86-9658B41DFA7C}.Debug|x86.Build.0 = Debug|x86
{5B823520-0450-44A9-AC86-9658B41DFA7C}.Release|Any CPU.ActiveCfg = Release|x86
{5B823520-0450-44A9-AC86-9658B41DFA7C}.Release|Mixed Platforms.ActiveCfg = Release|x86
{5B823520-0450-44A9-AC86-9658B41DFA7C}.Release|Mixed Platforms.Build.0 = Release|x86
{5B823520-0450-44A9-AC86-9658B41DFA7C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{5B823520-0450-44A9-AC86-9658B41DFA7C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{5B823520-0450-44A9-AC86-9658B41DFA7C}.Release|x86.ActiveCfg = Release|x86
{5B823520-0450-44A9-AC86-9658B41DFA7C}.Release|x86.Build.0 = Release|x86
EndGlobalSection

View file

@ -5,7 +5,7 @@
</configSections>
<!-- Connection strings -->
<connectionStrings>
<add name="EnterpriseServer" connectionString="Server=(local)\SQLExpress;Database=WebsitePanel;uid=sa;pwd=Password12" providerName="System.Data.SqlClient" />
<add name="EnterpriseServer" connectionString="Server=(local)\SQLExpress;Database=WebsitePanel;uid=sa;pwd=Password12" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<!-- Encryption util settings -->
@ -50,7 +50,7 @@
</messaging>
<security>
<securityTokenManager>
<add type="WebsitePanel.EnterpriseServer.ServiceUsernameTokenManager, WebsitePanel.EnterpriseServer" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" localName="UsernameToken" />
<add type="WebsitePanel.EnterpriseServer.ServiceUsernameTokenManager, WebsitePanel.EnterpriseServer.Code" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" localName="UsernameToken" />
</securityTokenManager>
</security>
<policy fileName="WsePolicyCache.Config" />

View file

@ -70,6 +70,9 @@
<Reference Include="WebsitePanel.EnterpriseServer.Base">
<HintPath>..\..\Bin\WebsitePanel.EnterpriseServer.Base.dll</HintPath>
</Reference>
<Reference Include="WebsitePanel.EnterpriseServer.Code">
<HintPath>..\..\Bin\WebsitePanel.EnterpriseServer.Code.dll</HintPath>
</Reference>
<Reference Include="WebsitePanel.Providers.Base">
<HintPath>..\..\Bin\WebsitePanel.Providers.Base.dll</HintPath>
</Reference>
@ -266,12 +269,6 @@
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WebsitePanel.EnterpriseServer.Code\WebsitePanel.EnterpriseServer.Code.csproj">
<Project>{60E39314-659C-4FAD-AB91-D0D08E223578}</Project>
<Name>WebsitePanel.EnterpriseServer.Code</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="ecServiceHandler.asmx" />
<Content Include="esBlackBerry.asmx" />
@ -283,7 +280,6 @@
<None Include="TaskEventHandlers.config" />
<None Include="WsePolicyCache.Config" />
</ItemGroup>
<ItemGroup />
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

View file

@ -1,6 +1,6 @@
<policies xmlns="http://schemas.microsoft.com/wse/2005/06/policy">
<extensions>
<extension name="usernameAssertion" type="WebsitePanel.EnterpriseServer.UsernameAssertion, WebsitePanel.EnterpriseServer" />
<extension name="usernameAssertion" type="WebsitePanel.EnterpriseServer.UsernameAssertion, WebsitePanel.EnterpriseServer.Code" />
</extensions>
<policy name="ServerPolicy">
<usernameAssertion/>

View file

@ -1,23 +1,10 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Timers;
using System.ServiceProcess;
using WebsitePanel.EnterpriseServer;
namespace WebsitePanel.SchedulerService
{
public partial class SchedulerService : ServiceBase
{
#region Properties
public Timer _Timer { get; protected set; }
#endregion
#region Construcor
public SchedulerService()
@ -31,17 +18,9 @@ namespace WebsitePanel.SchedulerService
protected override void OnStart(string[] args)
{
}
protected override void OnStop()
{
_Timer.Dispose();
}
protected void Porcess(object state)
{
Scheduler.Start();
}
#endregion
}
}
}

View file

@ -0,0 +1,28 @@
using System.ComponentModel;
using System.Configuration.Install;
using System.ServiceProcess;
namespace WebsitePanel.SchedulerService
{
[RunInstaller(true)]
public class SchedulerServiceInstaller : Installer
{
#region Constructor
public SchedulerServiceInstaller()
{
var processInstaller = new ServiceProcessInstaller();
var serviceInstaller = new ServiceInstaller();
processInstaller.Account = ServiceAccount.LocalSystem;
serviceInstaller.DisplayName = "WebsitePanel Scheduler";
serviceInstaller.StartType = ServiceStartMode.Automatic;
serviceInstaller.ServiceName = "WebsitePanlel Scheduler";
Installers.Add(processInstaller);
Installers.Add(serviceInstaller);
}
#endregion
}
}

View file

@ -11,7 +11,8 @@
<RootNamespace>WebsitePanel.SchedulerService</RootNamespace>
<AssemblyName>WebsitePanel.SchedulerService</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@ -33,8 +34,27 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\WebsitePanel.EnterpriseServer\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>..\WebsitePanel.EnterpriseServer\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@ -52,6 +72,9 @@
<Compile Include="SchedulerService.Designer.cs">
<DependentUpon>SchedulerService.cs</DependentUpon>
</Compile>
<Compile Include="SchedulerServiceInstaller.cs">
<SubType>Component</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WebsitePanel.EnterpriseServer.Code\WebsitePanel.EnterpriseServer.Code.csproj">
@ -59,6 +82,9 @@
<Name>WebsitePanel.EnterpriseServer.Code</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View file

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="EnterpriseServer" connectionString="Server=VITALIK-VAIO\SQL2008R2;Database=WebsitePanel;Trusted_Connection=Yes;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>

View file

@ -361,6 +361,7 @@
<MakeDir Directories="$(EnterpriseServerInstall)"/>
<Copy SourceFiles="@(EnterpriseServerDeployFiles)" DestinationFolder="$(EnterpriseServerInstall)\%(RecursiveDir)" />
<XmlUpdate XmlFileName="$(EnterpriseServerInstall)\web.config" Xpath="//configuration/connectionStrings/add/@connectionString" Value="${installer.connectionstring}" />
<XmlUpdate XmlFileName="$(EnterpriseServerInstall)\bin\WebsitePanel.SchedulerService.exe.config" Xpath="//configuration/connectionStrings/add/@connectionString" Value="${installer.connectionstring}" />
<XmlUpdate XmlFileName="$(EnterpriseServerInstall)\web.config" Xpath="//configuration/appSettings/add[@key=%22WebsitePanel.CryptoKey%22]/@value" Value="${installer.cryptokey}" />
</Target>