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

@ -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>