JobRunner, ADInterface
This commit is contained in:
parent
2296b31519
commit
a8ed35aee2
@ -69,10 +69,10 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "License", "Modules.License\
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ADSyncTest", "GUIs.Test.ADSyncTest\ADSyncTest.vbproj", "{7386AB04-DF8D-4DFB-809D-1FAC8212CB7E}"
|
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ADSyncTest", "GUIs.Test.ADSyncTest\ADSyncTest.vbproj", "{7386AB04-DF8D-4DFB-809D-1FAC8212CB7E}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "JobRunner", "JobRunner\JobRunner.vbproj", "{59461E98-A5AF-438C-A651-5021ACAE82AD}"
|
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GUIs.Test", "GUIs.Test", "{CC368D6A-6AC4-4EB9-A092-14700FABEF7A}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GUIs.Test", "GUIs.Test", "{CC368D6A-6AC4-4EB9-A092-14700FABEF7A}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "JobRunner", "Service.JobRunner\JobRunner.vbproj", "{926E6474-5613-4373-BB99-B101158B91EF}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -175,10 +175,10 @@ Global
|
|||||||
{7386AB04-DF8D-4DFB-809D-1FAC8212CB7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{7386AB04-DF8D-4DFB-809D-1FAC8212CB7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{7386AB04-DF8D-4DFB-809D-1FAC8212CB7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{7386AB04-DF8D-4DFB-809D-1FAC8212CB7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{7386AB04-DF8D-4DFB-809D-1FAC8212CB7E}.Release|Any CPU.Build.0 = Release|Any CPU
|
{7386AB04-DF8D-4DFB-809D-1FAC8212CB7E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{59461E98-A5AF-438C-A651-5021ACAE82AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{926E6474-5613-4373-BB99-B101158B91EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{59461E98-A5AF-438C-A651-5021ACAE82AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{926E6474-5613-4373-BB99-B101158B91EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{59461E98-A5AF-438C-A651-5021ACAE82AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{926E6474-5613-4373-BB99-B101158B91EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{59461E98-A5AF-438C-A651-5021ACAE82AD}.Release|Any CPU.Build.0 = Release|Any CPU
|
{926E6474-5613-4373-BB99-B101158B91EF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -208,7 +208,7 @@ Global
|
|||||||
{CBE9322E-67A1-4CC5-B25F-4A1B4C9FC55C} = {7AF3F9C2-C939-4A08-95C1-0453207E298A}
|
{CBE9322E-67A1-4CC5-B25F-4A1B4C9FC55C} = {7AF3F9C2-C939-4A08-95C1-0453207E298A}
|
||||||
{5EBACBFA-F11A-4BBF-8D02-91461F2293ED} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC}
|
{5EBACBFA-F11A-4BBF-8D02-91461F2293ED} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC}
|
||||||
{7386AB04-DF8D-4DFB-809D-1FAC8212CB7E} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A}
|
{7386AB04-DF8D-4DFB-809D-1FAC8212CB7E} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A}
|
||||||
{59461E98-A5AF-438C-A651-5021ACAE82AD} = {7AF3F9C2-C939-4A08-95C1-0453207E298A}
|
{926E6474-5613-4373-BB99-B101158B91EF} = {7AF3F9C2-C939-4A08-95C1-0453207E298A}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286}
|
SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286}
|
||||||
|
|||||||
@ -20,8 +20,6 @@ Public Class Form1
|
|||||||
|
|
||||||
_sync = New ActiveDirectoryInterface(_logConfig, Nothing, _sql)
|
_sync = New ActiveDirectoryInterface(_logConfig, Nothing, _sql)
|
||||||
_sync.Authenticate()
|
_sync.Authenticate()
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||||
|
|||||||
@ -1,83 +0,0 @@
|
|||||||
Imports System.ComponentModel
|
|
||||||
Imports System.Timers
|
|
||||||
Imports DigitalData.Modules.Database
|
|
||||||
Imports DigitalData.Modules.Jobs
|
|
||||||
Imports DigitalData.Modules.Logging
|
|
||||||
|
|
||||||
Public Class JobRunner
|
|
||||||
Private WithEvents _workerThread As BackgroundWorker
|
|
||||||
Private WithEvents _workerTimer As Timer
|
|
||||||
|
|
||||||
Private ReadOnly _interval As Long
|
|
||||||
Private ReadOnly _logConfig As LogConfig
|
|
||||||
Private ReadOnly _logger As Logger
|
|
||||||
Private ReadOnly _mssql As MSSQLServer
|
|
||||||
Private ReadOnly _firebird As Firebird
|
|
||||||
|
|
||||||
Public Sub New(LogConfig As LogConfig, Firebird As Firebird, MSSQL As MSSQLServer, Interval As Long)
|
|
||||||
_logConfig = LogConfig
|
|
||||||
_logger = _logConfig.GetLogger()
|
|
||||||
_firebird = Firebird
|
|
||||||
_mssql = MSSQL
|
|
||||||
_interval = Interval
|
|
||||||
|
|
||||||
_workerTimer = New Timer()
|
|
||||||
_workerThread = New BackgroundWorker() With {
|
|
||||||
.WorkerReportsProgress = True,
|
|
||||||
.WorkerSupportsCancellation = True
|
|
||||||
}
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Sub Start()
|
|
||||||
_workerTimer.Interval = _interval * 1000
|
|
||||||
_workerTimer.Start()
|
|
||||||
_logger.Debug("JobRunner started with {0}s Interval.", _interval)
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Sub [Stop]()
|
|
||||||
Try
|
|
||||||
_logger.Debug("Stopping Background worker...")
|
|
||||||
If _workerThread.IsBusy Then
|
|
||||||
_workerThread.CancelAsync()
|
|
||||||
_logger.Debug("Background Worker cancelled.")
|
|
||||||
End If
|
|
||||||
_workerTimer.Stop()
|
|
||||||
_logger.Debug("Background Worker stopped.")
|
|
||||||
Catch ex As Exception
|
|
||||||
_logger.Error(ex)
|
|
||||||
End Try
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub TimerElapsed(sender As Object, e As ElapsedEventArgs) Handles _workerTimer.Elapsed
|
|
||||||
If Not _workerThread.IsBusy Then
|
|
||||||
_workerThread.RunWorkerAsync()
|
|
||||||
Else
|
|
||||||
_logger.Warn("Background Worker is busy. Waiting for next interval.")
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub DoWork(sender As Object, e As DoWorkEventArgs) Handles _workerThread.DoWork
|
|
||||||
_logger.Debug("Background worker running..")
|
|
||||||
|
|
||||||
Dim args As WorkerArgs = e.Argument
|
|
||||||
Dim oJob As New ADSyncJob(_logConfig, _firebird, _mssql)
|
|
||||||
Dim oArgs As New ADSyncArgs() With {
|
|
||||||
.Enabled = My.Settings.JOB_ADSYNC_ENABLED,
|
|
||||||
.Interval = My.Settings.JOB_ADSYNC_INTERVAL,
|
|
||||||
.RootPath = My.Settings.JOB_ADSYNC_ROOT_PATH
|
|
||||||
}
|
|
||||||
|
|
||||||
If oJob.ShouldStart(oArgs) Then
|
|
||||||
oJob.Start(oArgs)
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub WorkCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles _workerThread.RunWorkerCompleted
|
|
||||||
If e.Error Is Nothing Then
|
|
||||||
_logger.Debug("Background worker completed!")
|
|
||||||
Else
|
|
||||||
_logger.Warn("Background worker failed!")
|
|
||||||
_logger.Error(e.Error)
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
End Class
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
|
|
||||||
<Profiles />
|
|
||||||
<Settings>
|
|
||||||
<Setting Name="SERVICE_NAME" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)">DDJobRunner</Value>
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="SERVICE_DISPLAY_NAME" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)">Digital Data Job Runner</Value>
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="JOB_ADSYNC_ENABLED" Type="System.Boolean" Scope="Application">
|
|
||||||
<Value Profile="(Default)">False</Value>
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="DB_DATASOURCE" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)" />
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="DB_DATABASE" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)" />
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="DB_USER" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)" />
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="DB_PASSWORD" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)" />
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="JOB_INTERVAL" Type="System.Int64" Scope="Application">
|
|
||||||
<Value Profile="(Default)">120</Value>
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="JOB_ADSYNC_INTERVAL" Type="System.Int64" Scope="Application">
|
|
||||||
<Value Profile="(Default)">120</Value>
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="JOB_ADSYNC_ROOT_PATH" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)" />
|
|
||||||
</Setting>
|
|
||||||
<Setting Name="DB_CONNECTIONSTRING" Type="System.String" Scope="Application">
|
|
||||||
<Value Profile="(Default)" />
|
|
||||||
</Setting>
|
|
||||||
</Settings>
|
|
||||||
</SettingsFile>
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
Imports System.ComponentModel
|
|
||||||
Imports System.Configuration.Install
|
|
||||||
Imports System.ServiceProcess
|
|
||||||
|
|
||||||
<RunInstaller(True)>
|
|
||||||
Public Class ProjectInstaller
|
|
||||||
Inherits Installer
|
|
||||||
|
|
||||||
Private ReadOnly process As ServiceProcessInstaller
|
|
||||||
Private ReadOnly components As IContainer
|
|
||||||
Private ReadOnly service As ServiceInstaller
|
|
||||||
|
|
||||||
Public Sub New()
|
|
||||||
process = New ServiceProcessInstaller With {
|
|
||||||
.Account = ServiceAccount.LocalSystem
|
|
||||||
}
|
|
||||||
service = New ServiceInstaller With {
|
|
||||||
.ServiceName = My.Settings.SERVICE_NAME,
|
|
||||||
.DisplayName = My.Settings.SERVICE_DISPLAY_NAME
|
|
||||||
}
|
|
||||||
Installers.Add(process)
|
|
||||||
Installers.Add(service)
|
|
||||||
End Sub
|
|
||||||
End Class
|
|
||||||
@ -1,48 +0,0 @@
|
|||||||
Imports System.IO
|
|
||||||
Imports DigitalData.Modules.Database
|
|
||||||
Imports DigitalData.Modules.Logging
|
|
||||||
Imports DigitalData.Modules.Logging.LogConfig
|
|
||||||
|
|
||||||
Public Class WindowsService
|
|
||||||
Private _logConfig As LogConfig
|
|
||||||
Private _logger As Logger
|
|
||||||
Private _firebird As Firebird
|
|
||||||
Private _mssql As MSSQLServer
|
|
||||||
|
|
||||||
Private _jobRunner As JobRunner2
|
|
||||||
|
|
||||||
Protected Overrides Sub OnStart(ByVal args() As String)
|
|
||||||
_logConfig = New LogConfig(PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log"))
|
|
||||||
_logConfig.Debug = True
|
|
||||||
_logger = _logConfig.GetLogger()
|
|
||||||
_logger.Info($"{My.Settings.SERVICE_NAME} is starting.")
|
|
||||||
|
|
||||||
Dim oDataSource As String = My.Settings.DB_DATASOURCE
|
|
||||||
Dim oDatabase As String = My.Settings.DB_DATABASE
|
|
||||||
Dim oUser As String = My.Settings.DB_USER
|
|
||||||
Dim oPassword As String = My.Settings.DB_PASSWORD
|
|
||||||
Dim oInterval As Long = My.Settings.JOB_INTERVAL
|
|
||||||
|
|
||||||
_firebird = New Firebird(_logConfig, oDataSource, oDatabase, oUser, oPassword)
|
|
||||||
_mssql = New MSSQLServer(_logConfig, My.Settings.DB_CONNECTIONSTRING)
|
|
||||||
|
|
||||||
Try
|
|
||||||
_jobRunner = New JobRunner2(_logConfig, _mssql, _firebird)
|
|
||||||
_jobRunner.Start()
|
|
||||||
Catch ex As Exception
|
|
||||||
_logger.Error(ex)
|
|
||||||
End Try
|
|
||||||
|
|
||||||
'Try
|
|
||||||
' _jobRunner = New JobRunner(_logConfig, _firebird, oInterval)
|
|
||||||
' _jobRunner.Start()
|
|
||||||
'Catch ex As Exception
|
|
||||||
' _logger.Error(ex)
|
|
||||||
'End Try
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Protected Overrides Sub OnStop()
|
|
||||||
_jobRunner.Stop()
|
|
||||||
_logger.Info($"{My.Settings.SERVICE_NAME} is stopping.")
|
|
||||||
End Sub
|
|
||||||
End Class
|
|
||||||
@ -13,9 +13,12 @@ Public Class ADSyncJob
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub Start(Arguments As ADSyncArgs) Implements IJob(Of ADSyncArgs).Start
|
Public Sub Start(Arguments As ADSyncArgs) Implements IJob(Of ADSyncArgs).Start
|
||||||
Dim oSync = New ActiveDirectoryInterface(_LogConfig, _Firebird, _MSSQL, Arguments.RootPath)
|
|
||||||
Dim oJobName As String = [GetType]().Name
|
Dim oJobName As String = [GetType]().Name
|
||||||
|
|
||||||
|
Try
|
||||||
|
Dim oSync = New ActiveDirectoryInterface(_LogConfig, _Firebird, _MSSQL, Arguments.RootPath)
|
||||||
|
|
||||||
|
|
||||||
_Logger.Info("Running job {0}", oJobName)
|
_Logger.Info("Running job {0}", oJobName)
|
||||||
|
|
||||||
If oSync.Authenticate() = False Then
|
If oSync.Authenticate() = False Then
|
||||||
@ -34,12 +37,15 @@ Public Class ADSyncJob
|
|||||||
If oSyncedUsers Is Nothing Then
|
If oSyncedUsers Is Nothing Then
|
||||||
_Logger.Warn("Group {0} could not be synced!", oGroup)
|
_Logger.Warn("Group {0} could not be synced!", oGroup)
|
||||||
Else
|
Else
|
||||||
_Logger.Debug("Group {0} synced", oGroup)
|
_Logger.Debug("Synced {0} users for group {1}", oSyncedUsers.Count, oGroup)
|
||||||
_Logger.Debug("Synced {0} users", oSyncedUsers.Count)
|
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
_Logger.Info("Job {0} completed!", oJobName)
|
_Logger.Info("Job {0} completed!", oJobName)
|
||||||
|
Catch ex As Exception
|
||||||
|
_Logger.Warn("Job {0} failed!", oJobName)
|
||||||
|
_Logger.Error(ex)
|
||||||
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Function ShouldStart(Arguments As ADSyncArgs) As Boolean Implements IJob(Of ADSyncArgs).ShouldStart
|
Public Function ShouldStart(Arguments As ADSyncArgs) As Boolean Implements IJob(Of ADSyncArgs).ShouldStart
|
||||||
|
|||||||
@ -34,10 +34,17 @@ Public Class ActiveDirectoryInterface
|
|||||||
Else
|
Else
|
||||||
_rootPath = RootPath
|
_rootPath = RootPath
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
_logger.Info("Using RootPath {0}", _rootPath)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Function SyncUsersForGroup(GroupName As String) As List(Of ADUser)
|
Public Function SyncUsersForGroup(GroupName As String) As List(Of ADUser)
|
||||||
|
Try
|
||||||
Return SyncUsersForGroup(GroupName, New List(Of AttributeMapping))
|
Return SyncUsersForGroup(GroupName, New List(Of AttributeMapping))
|
||||||
|
Catch ex As Exception
|
||||||
|
_logger.Error(ex)
|
||||||
|
Return Nothing
|
||||||
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function SyncUsersForGroup(GroupName As String, AttributeMappings As List(Of AttributeMapping)) As List(Of ADUser)
|
Public Function SyncUsersForGroup(GroupName As String, AttributeMappings As List(Of AttributeMapping)) As List(Of ADUser)
|
||||||
@ -143,13 +150,18 @@ Public Class ActiveDirectoryInterface
|
|||||||
Return oUsers
|
Return oUsers
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
_logger.Debug("Listing members of Group {0}", GroupName)
|
||||||
|
|
||||||
Using oMembers = oGroupPrincipal.GetMembers(True)
|
Using oMembers = oGroupPrincipal.GetMembers(True)
|
||||||
For Each oMember As Principal In oMembers
|
For Each oMember As Principal In oMembers
|
||||||
|
Try
|
||||||
If TypeOf oMember Is UserPrincipal Then
|
If TypeOf oMember Is UserPrincipal Then
|
||||||
Dim oUser As UserPrincipal = DirectCast(oMember, UserPrincipal)
|
Dim oUser As UserPrincipal = DirectCast(oMember, UserPrincipal)
|
||||||
Dim oUserEx As UserPrincipalEx = UserPrincipalEx.FindByIdentity(oContext, oUser.SamAccountName)
|
Dim oUserEx As UserPrincipalEx = UserPrincipalEx.FindByIdentity(oContext, oUser.SamAccountName)
|
||||||
Dim oCustomAttributes As New List(Of ADUser.CustomAttribute)
|
Dim oCustomAttributes As New List(Of ADUser.CustomAttribute)
|
||||||
|
|
||||||
|
' TODO: Figure out why oUserEx can be nothing for certain users
|
||||||
|
If oUserEx IsNot Nothing Then
|
||||||
For Each oMap As AttributeMapping In AttributeMappings
|
For Each oMap As AttributeMapping In AttributeMappings
|
||||||
Dim oAttributeValue = oUserEx.GetAttributeValue(oMap.AttributeName)
|
Dim oAttributeValue = oUserEx.GetAttributeValue(oMap.AttributeName)
|
||||||
|
|
||||||
@ -164,18 +176,27 @@ Public Class ActiveDirectoryInterface
|
|||||||
})
|
})
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
Else
|
||||||
oUsers.Add(New ADUser() With {
|
_logger.Warn("Could not fetch CustomAttributes for user {0}", oUser)
|
||||||
.GUID = oUserEx.Guid,
|
|
||||||
.SId = oUserEx.Sid,
|
|
||||||
.samAccountName = oUserEx.SamAccountName,
|
|
||||||
.Surname = oUserEx.Surname,
|
|
||||||
.Middlename = oUserEx.MiddleName,
|
|
||||||
.GivenName = oUserEx.GivenName,
|
|
||||||
.Email = oUserEx.EmailAddress,
|
|
||||||
.CustomAttributes = oCustomAttributes
|
|
||||||
})
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
_logger.Info("Trying to add User {0} to user list", oUser)
|
||||||
|
|
||||||
|
Dim oNewUser As New ADUser With {
|
||||||
|
.SId = oUser.Sid,
|
||||||
|
.samAccountName = oUser.SamAccountName,
|
||||||
|
.Middlename = oUser.MiddleName,
|
||||||
|
.GivenName = oUser.GivenName,
|
||||||
|
.Email = oUser.EmailAddress,
|
||||||
|
.CustomAttributes = oCustomAttributes
|
||||||
|
}
|
||||||
|
|
||||||
|
oUsers.Add(oNewUser)
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
_logger.Warn("User could not be processed")
|
||||||
|
_logger.Error(ex)
|
||||||
|
End Try
|
||||||
Next
|
Next
|
||||||
End Using
|
End Using
|
||||||
End Using
|
End Using
|
||||||
@ -184,7 +205,7 @@ Public Class ActiveDirectoryInterface
|
|||||||
Return oUsers
|
Return oUsers
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Error(ex)
|
_logger.Error(ex)
|
||||||
Throw ex
|
Return oUsers
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
@ -229,7 +250,7 @@ Public Class ActiveDirectoryInterface
|
|||||||
Try
|
Try
|
||||||
Return Result.Properties.Item(PropertyName).Item(0)
|
Return Result.Properties.Item(PropertyName).Item(0)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Warn("Property {0} not found")
|
_logger.Warn("Property {0} not found", PropertyName)
|
||||||
Return String.Empty
|
Return String.Empty
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
@ -8,6 +8,6 @@
|
|||||||
Public ObjectCategory As String
|
Public ObjectCategory As String
|
||||||
|
|
||||||
Public Overrides Function ToString() As String
|
Public Overrides Function ToString() As String
|
||||||
Return $"SAMAccountName={SAMAccountName}, ObjectClass={ObjectClass}, CN={CN}, Description={Description}, DistinguishedName={DistinguishedName}, Name={Name}, ObjectCategory={ObjectCategory}"
|
Return $"SAMAccountName={SAMAccountName}"
|
||||||
End Function
|
End Function
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@ -5,42 +5,27 @@
|
|||||||
<section name="DigitalData.Services.JobRunner.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
<section name="DigitalData.Services.JobRunner.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||||
</sectionGroup>
|
</sectionGroup>
|
||||||
</configSections>
|
</configSections>
|
||||||
<startup>
|
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
|
||||||
</startup>
|
|
||||||
<applicationSettings>
|
<applicationSettings>
|
||||||
<DigitalData.Services.JobRunner.My.MySettings>
|
<DigitalData.Services.JobRunner.My.MySettings>
|
||||||
<setting name="SERVICE_NAME" serializeAs="String">
|
|
||||||
<value>DDJobRunner</value>
|
|
||||||
</setting>
|
|
||||||
<setting name="SERVICE_DISPLAY_NAME" serializeAs="String">
|
|
||||||
<value>Digital Data Job Runner</value>
|
|
||||||
</setting>
|
|
||||||
<setting name="JOB_ADSYNC_ENABLED" serializeAs="String">
|
|
||||||
<value>False</value>
|
|
||||||
</setting>
|
|
||||||
<setting name="DB_DATASOURCE" serializeAs="String">
|
|
||||||
<value />
|
|
||||||
</setting>
|
|
||||||
<setting name="DB_DATABASE" serializeAs="String">
|
|
||||||
<value />
|
|
||||||
</setting>
|
|
||||||
<setting name="DB_USER" serializeAs="String">
|
|
||||||
<value />
|
|
||||||
</setting>
|
|
||||||
<setting name="DB_PASSWORD" serializeAs="String">
|
|
||||||
<value />
|
|
||||||
</setting>
|
|
||||||
<setting name="JOB_INTERVAL" serializeAs="String">
|
|
||||||
<value>120</value>
|
|
||||||
</setting>
|
|
||||||
<setting name="JOB_ADSYNC_INTERVAL" serializeAs="String">
|
|
||||||
<value>120</value>
|
|
||||||
</setting>
|
|
||||||
<setting name="JOB_ADSYNC_ROOT_PATH" serializeAs="String">
|
<setting name="JOB_ADSYNC_ROOT_PATH" serializeAs="String">
|
||||||
<value />
|
<value />
|
||||||
</setting>
|
</setting>
|
||||||
<setting name="DB_CONNECTIONSTRING" serializeAs="String">
|
<setting name="LOG_PATH" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
<setting name="SQL_CONNECTIONSTRING" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
<setting name="FIREBIRD_SERVER" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
<setting name="FIREBIRD_DATABASE" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
<setting name="FIREBIRD_USER" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
<setting name="FIREBIRD_PASSWORD" serializeAs="String">
|
||||||
<value />
|
<value />
|
||||||
</setting>
|
</setting>
|
||||||
</DigitalData.Services.JobRunner.My.MySettings>
|
</DigitalData.Services.JobRunner.My.MySettings>
|
||||||
@ -6,9 +6,9 @@ Imports Quartz
|
|||||||
Imports Quartz.Impl
|
Imports Quartz.Impl
|
||||||
Imports Quartz.Logging
|
Imports Quartz.Logging
|
||||||
|
|
||||||
Public Class JobRunner2
|
Public Class JobRunner
|
||||||
Private _LogConfig As LogConfig
|
Private _LogConfig As LogConfig
|
||||||
Private _Logger As Modules.Logging.Logger
|
Private _Logger As DigitalData.Modules.Logging.Logger
|
||||||
Private _firebird As Firebird
|
Private _firebird As Firebird
|
||||||
Private _mssql As MSSQLServer
|
Private _mssql As MSSQLServer
|
||||||
|
|
||||||
@ -26,15 +26,20 @@ Public Class JobRunner2
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Async Sub Start()
|
Public Async Sub Start()
|
||||||
|
Try
|
||||||
Logging.LogProvider.SetCurrentLogProvider(New LogProvider(_Logger))
|
Logging.LogProvider.SetCurrentLogProvider(New LogProvider(_Logger))
|
||||||
|
|
||||||
|
_Logger.Info("Starting JobRunner")
|
||||||
|
|
||||||
Dim oProps As New NameValueCollection From {
|
Dim oProps As New NameValueCollection From {
|
||||||
{"quartz.serializer.type", "binary"}
|
{"quartz.serializer.type", "binary"}
|
||||||
}
|
}
|
||||||
_factory = New StdSchedulerFactory(oProps)
|
_factory = New StdSchedulerFactory(oProps)
|
||||||
_scheduler = Await _factory.GetScheduler()
|
_scheduler = Await _factory.GetScheduler()
|
||||||
|
|
||||||
|
_Logger.Info("Starting Scheduler..")
|
||||||
Await _scheduler.Start()
|
Await _scheduler.Start()
|
||||||
|
_Logger.Info("Done")
|
||||||
|
|
||||||
Dim oJobData As New JobDataMap From {
|
Dim oJobData As New JobDataMap From {
|
||||||
{"LogConfig", _LogConfig},
|
{"LogConfig", _LogConfig},
|
||||||
@ -51,20 +56,26 @@ Public Class JobRunner2
|
|||||||
Dim oTrigger = TriggerBuilder.Create().
|
Dim oTrigger = TriggerBuilder.Create().
|
||||||
WithIdentity("activedirectory-sync-trigger").
|
WithIdentity("activedirectory-sync-trigger").
|
||||||
StartNow().
|
StartNow().
|
||||||
WithCronSchedule("1 0 * * *").
|
WithCronSchedule("0 0/1 * * * ?").
|
||||||
Build()
|
Build()
|
||||||
|
|
||||||
|
_Logger.Info("Starting ADSync Job..")
|
||||||
Await _scheduler.ScheduleJob(oJobDetail, oTrigger)
|
Await _scheduler.ScheduleJob(oJobDetail, oTrigger)
|
||||||
|
_Logger.Info("Done")
|
||||||
|
Catch ex As Exception
|
||||||
|
_Logger.Error(ex)
|
||||||
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Async Sub [Stop]()
|
Public Async Sub [Stop]()
|
||||||
|
_Logger.Info("Stopping JobRunner")
|
||||||
Await _scheduler.Shutdown()
|
Await _scheduler.Shutdown()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Class ADJob
|
Public Class ADJob
|
||||||
Implements Quartz.IJob
|
Implements Quartz.IJob
|
||||||
|
|
||||||
Public Async Function Execute(context As IJobExecutionContext) As Task Implements Quartz.IJob.Execute
|
Public Function Execute(context As IJobExecutionContext) As Task Implements Quartz.IJob.Execute
|
||||||
Dim oJobData = context.MergedJobDataMap
|
Dim oJobData = context.MergedJobDataMap
|
||||||
Dim oLogConfig As LogConfig = oJobData.Item("LogConfig")
|
Dim oLogConfig As LogConfig = oJobData.Item("LogConfig")
|
||||||
Dim oFirebird As Firebird = oJobData.Item("Firebird")
|
Dim oFirebird As Firebird = oJobData.Item("Firebird")
|
||||||
@ -77,24 +88,28 @@ Public Class JobRunner2
|
|||||||
Dim oADSyncJob As New ADSyncJob(oLogConfig, oFirebird, oMSSQL)
|
Dim oADSyncJob As New ADSyncJob(oLogConfig, oFirebird, oMSSQL)
|
||||||
oADSyncJob.Start(oADJobArgs)
|
oADSyncJob.Start(oADJobArgs)
|
||||||
|
|
||||||
Await Task.CompletedTask
|
Return Task.FromResult(True)
|
||||||
End Function
|
End Function
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
Private Class LogProvider
|
Private Class LogProvider
|
||||||
Implements ILogProvider
|
Implements ILogProvider
|
||||||
|
|
||||||
Private _Logger As Modules.Logging.Logger
|
Private _Logger As DigitalData.Modules.Logging.Logger
|
||||||
|
|
||||||
Public Sub New(Logger As Modules.Logging.Logger)
|
Public Sub New(Logger As DigitalData.Modules.Logging.Logger)
|
||||||
MyBase.New()
|
MyBase.New()
|
||||||
_Logger = Logger
|
_Logger = Logger
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function GetLogger(name As String) As Logging.Logger Implements ILogProvider.GetLogger
|
Private Function GetLogger(name As String) As Logging.Logger Implements ILogProvider.GetLogger
|
||||||
Return Function(level, func, exception, parameters)
|
Return Function(level, func, exception, parameters)
|
||||||
If level >= LogLevel.Info AndAlso func IsNot Nothing Then
|
If exception IsNot Nothing Then
|
||||||
_Logger.Info(func())
|
_Logger.Error(exception)
|
||||||
|
ElseIf level >= LogLevel.Debug AndAlso func IsNot Nothing Then
|
||||||
|
_Logger.Debug(func(), parameters)
|
||||||
|
ElseIf level >= LogLevel.Info AndAlso func IsNot Nothing Then
|
||||||
|
_Logger.Info(func(), parameters)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return True
|
Return True
|
||||||
@ -102,10 +117,12 @@ Public Class JobRunner2
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function OpenNestedContext(message As String) As IDisposable Implements ILogProvider.OpenNestedContext
|
Private Function OpenNestedContext(message As String) As IDisposable Implements ILogProvider.OpenNestedContext
|
||||||
|
_Logger.Warn("OpenNestedContext is not implemented")
|
||||||
Throw New NotImplementedException()
|
Throw New NotImplementedException()
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function OpenMappedContext(key As String, value As String) As IDisposable Implements ILogProvider.OpenMappedContext
|
Private Function OpenMappedContext(key As String, value As String) As IDisposable Implements ILogProvider.OpenMappedContext
|
||||||
|
_Logger.Warn("OpenMappedContext is not implemented")
|
||||||
Throw New NotImplementedException()
|
Throw New NotImplementedException()
|
||||||
End Function
|
End Function
|
||||||
End Class
|
End Class
|
||||||
@ -4,9 +4,9 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{59461E98-A5AF-438C-A651-5021ACAE82AD}</ProjectGuid>
|
<ProjectGuid>{926E6474-5613-4373-BB99-B101158B91EF}</ProjectGuid>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<StartupObject>DigitalData.Services.JobRunner.WindowsService</StartupObject>
|
<StartupObject>DigitalData.Services.JobRunner.JobRunnerService</StartupObject>
|
||||||
<RootNamespace>DigitalData.Services.JobRunner</RootNamespace>
|
<RootNamespace>DigitalData.Services.JobRunner</RootNamespace>
|
||||||
<AssemblyName>DigitalData.Services.JobRunner</AssemblyName>
|
<AssemblyName>DigitalData.Services.JobRunner</AssemblyName>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
@ -46,10 +46,13 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OptionInfer>On</OptionInfer>
|
<OptionInfer>On</OptionInfer>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\NLog.4.5.11\lib\net45\NLog.dll</HintPath>
|
<HintPath>..\packages\NLog.4.6.2\lib\net45\NLog.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Quartz, Version=3.0.7.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
|
<Reference Include="Quartz, Version=3.0.7.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Quartz.3.0.7\lib\net452\Quartz.dll</HintPath>
|
<HintPath>..\packages\Quartz.3.0.7\lib\net452\Quartz.dll</HintPath>
|
||||||
@ -59,14 +62,12 @@
|
|||||||
<Reference Include="System.Configuration.Install" />
|
<Reference Include="System.Configuration.Install" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Deployment" />
|
<Reference Include="System.Deployment" />
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
<Reference Include="System.IO.Compression" />
|
<Reference Include="System.IO.Compression" />
|
||||||
<Reference Include="System.Runtime.Remoting" />
|
<Reference Include="System.Runtime.Remoting" />
|
||||||
<Reference Include="System.Runtime.Serialization" />
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
<Reference Include="System.ServiceModel" />
|
<Reference Include="System.ServiceModel" />
|
||||||
<Reference Include="System.ServiceProcess" />
|
<Reference Include="System.ServiceProcess" />
|
||||||
<Reference Include="System.Transactions" />
|
<Reference Include="System.Transactions" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
@ -86,19 +87,15 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="JobRunner.vb" />
|
<Compile Include="JobRunner.vb" />
|
||||||
<Compile Include="JobRunner2.vb" />
|
|
||||||
<Compile Include="My Project\Application.Designer.vb">
|
<Compile Include="My Project\Application.Designer.vb">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DependentUpon>Application.myapp</DependentUpon>
|
<DependentUpon>Application.myapp</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="ProjectInstaller.vb">
|
<Compile Include="JobRunnerService.vb">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="WindowsService.vb">
|
<Compile Include="JobRunnerService.Designer.vb">
|
||||||
<SubType>Component</SubType>
|
<DependentUpon>JobRunnerService.vb</DependentUpon>
|
||||||
</Compile>
|
|
||||||
<Compile Include="WindowsService.Designer.vb">
|
|
||||||
<DependentUpon>WindowsService.vb</DependentUpon>
|
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||||
<Compile Include="My Project\Resources.Designer.vb">
|
<Compile Include="My Project\Resources.Designer.vb">
|
||||||
@ -111,19 +108,29 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="ProjectInstaller.Designer.vb">
|
||||||
|
<DependentUpon>ProjectInstaller.vb</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="ProjectInstaller.vb">
|
||||||
|
<SubType>Component</SubType>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="JobRunnerService.resx">
|
||||||
|
<DependentUpon>JobRunnerService.vb</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="My Project\Resources.resx">
|
<EmbeddedResource Include="My Project\Resources.resx">
|
||||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="WindowsService.resx">
|
<EmbeddedResource Include="ProjectInstaller.resx">
|
||||||
<DependentUpon>WindowsService.vb</DependentUpon>
|
<DependentUpon>ProjectInstaller.vb</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="My Project\app.manifest" />
|
||||||
<None Include="My Project\Application.myapp">
|
<None Include="My Project\Application.myapp">
|
||||||
<Generator>MyApplicationCodeGenerator</Generator>
|
<Generator>MyApplicationCodeGenerator</Generator>
|
||||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||||
@ -138,7 +145,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Jobs\Jobs.vbproj">
|
<ProjectReference Include="..\Jobs\Jobs.vbproj">
|
||||||
<Project>{39ec839a-3c30-4922-a41e-6b09d1dde5c3}</Project>
|
<Project>{39EC839A-3C30-4922-A41E-6B09D1DDE5C3}</Project>
|
||||||
<Name>Jobs</Name>
|
<Name>Jobs</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Modules.Database\Database.vbproj">
|
<ProjectReference Include="..\Modules.Database\Database.vbproj">
|
||||||
@ -1,11 +1,11 @@
|
|||||||
Imports System.ServiceProcess
|
Imports System.ServiceProcess
|
||||||
|
|
||||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
||||||
Partial Class WindowsService
|
Partial Class JobRunnerService
|
||||||
Inherits System.ServiceProcess.ServiceBase
|
Inherits System.ServiceProcess.ServiceBase
|
||||||
|
|
||||||
'UserService überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
|
'UserService überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
|
||||||
<System.Diagnostics.DebuggerNonUserCode()>
|
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||||
Try
|
Try
|
||||||
If disposing AndAlso components IsNot Nothing Then
|
If disposing AndAlso components IsNot Nothing Then
|
||||||
@ -17,8 +17,8 @@ Partial Class WindowsService
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
' Der Haupteinstiegspunkt für den Prozess
|
' Der Haupteinstiegspunkt für den Prozess
|
||||||
<MTAThread()>
|
<MTAThread()> _
|
||||||
<System.Diagnostics.DebuggerNonUserCode()>
|
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||||
Shared Sub Main()
|
Shared Sub Main()
|
||||||
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
|
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ Partial Class WindowsService
|
|||||||
'
|
'
|
||||||
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
|
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
|
||||||
'
|
'
|
||||||
ServicesToRun = New System.ServiceProcess.ServiceBase() {New WindowsService}
|
ServicesToRun = New System.ServiceProcess.ServiceBase() {New JobRunnerService}
|
||||||
|
|
||||||
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
|
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
|
||||||
End Sub
|
End Sub
|
||||||
@ -39,12 +39,14 @@ Partial Class WindowsService
|
|||||||
' Hinweis: Die folgende Prozedur ist für den Komponenten-Designer erforderlich.
|
' Hinweis: Die folgende Prozedur ist für den Komponenten-Designer erforderlich.
|
||||||
' Das Bearbeiten ist mit dem Komponenten-Designer möglich.
|
' Das Bearbeiten ist mit dem Komponenten-Designer möglich.
|
||||||
' Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
' Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
||||||
<System.Diagnostics.DebuggerStepThrough()>
|
<System.Diagnostics.DebuggerStepThrough()> _
|
||||||
Private Sub InitializeComponent()
|
Private Sub InitializeComponent()
|
||||||
'
|
'
|
||||||
'Service1
|
'JobRunnerService
|
||||||
'
|
'
|
||||||
Me.ServiceName = "Service1"
|
Me.CanShutdown = True
|
||||||
|
Me.ServiceName = "DDJobRunner"
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
38
Service.JobRunner/JobRunnerService.vb
Normal file
38
Service.JobRunner/JobRunnerService.vb
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
Imports DigitalData.Modules.Logging.LogConfig
|
||||||
|
Imports DigitalData.Modules.Database
|
||||||
|
Imports DigitalData.Services.JobRunner
|
||||||
|
|
||||||
|
Public Class JobRunnerService
|
||||||
|
Private _logConfig As LogConfig
|
||||||
|
Private _logger As Logger
|
||||||
|
Private _mssql As MSSQLServer
|
||||||
|
Private _firebird As Firebird
|
||||||
|
Private _jobrunner As JobRunner
|
||||||
|
|
||||||
|
Protected Overrides Sub OnStart(ByVal args() As String)
|
||||||
|
_logConfig = New LogConfig(PathType.CustomPath, My.Settings.LOG_PATH)
|
||||||
|
_logConfig.Debug = True
|
||||||
|
_logger = _logConfig.GetLogger()
|
||||||
|
_logger.Info("Starting Service {0}", ServiceName)
|
||||||
|
|
||||||
|
Try
|
||||||
|
_mssql = New MSSQLServer(_logConfig, My.Settings.SQL_CONNECTIONSTRING)
|
||||||
|
_firebird = New Firebird(_logConfig, My.Settings.FIREBIRD_SERVER, My.Settings.FIREBIRD_DATABASE, My.Settings.FIREBIRD_USER, My.Settings.FIREBIRD_PASSWORD)
|
||||||
|
Catch ex As Exception
|
||||||
|
_logger.Error(ex)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Try
|
||||||
|
_jobrunner = New JobRunner(_logConfig, _mssql, _firebird)
|
||||||
|
_jobrunner.Start()
|
||||||
|
Catch ex As Exception
|
||||||
|
_logger.Error(ex)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Protected Overrides Sub OnStop()
|
||||||
|
_jobrunner.Stop()
|
||||||
|
_logger.Info("Stopping Service {0}", ServiceName)
|
||||||
|
End Sub
|
||||||
|
End Class
|
||||||
@ -8,17 +8,17 @@ Imports System.Runtime.InteropServices
|
|||||||
|
|
||||||
' Werte der Assemblyattribute überprüfen
|
' Werte der Assemblyattribute überprüfen
|
||||||
|
|
||||||
<Assembly: AssemblyTitle("JobRunner")>
|
<Assembly: AssemblyTitle("Service.JobRunner")>
|
||||||
<Assembly: AssemblyDescription("")>
|
<Assembly: AssemblyDescription("")>
|
||||||
<Assembly: AssemblyCompany("")>
|
<Assembly: AssemblyCompany("")>
|
||||||
<Assembly: AssemblyProduct("JobRunner")>
|
<Assembly: AssemblyProduct("Service.JobRunner")>
|
||||||
<Assembly: AssemblyCopyright("Copyright © 2019")>
|
<Assembly: AssemblyCopyright("Copyright © 2019")>
|
||||||
<Assembly: AssemblyTrademark("")>
|
<Assembly: AssemblyTrademark("")>
|
||||||
|
|
||||||
<Assembly: ComVisible(False)>
|
<Assembly: ComVisible(False)>
|
||||||
|
|
||||||
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
|
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
|
||||||
<Assembly: Guid("5d2eb259-f8bd-4e9b-a121-afbb3fe90d13")>
|
<Assembly: Guid("01496bb6-b3df-4dca-995c-33fcc0b773e2")>
|
||||||
|
|
||||||
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||||
'
|
'
|
||||||
@ -54,87 +54,6 @@ Namespace My
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("DDJobRunner")> _
|
|
||||||
Public ReadOnly Property SERVICE_NAME() As String
|
|
||||||
Get
|
|
||||||
Return CType(Me("SERVICE_NAME"),String)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("Digital Data Job Runner")> _
|
|
||||||
Public ReadOnly Property SERVICE_DISPLAY_NAME() As String
|
|
||||||
Get
|
|
||||||
Return CType(Me("SERVICE_DISPLAY_NAME"),String)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("False")> _
|
|
||||||
Public ReadOnly Property JOB_ADSYNC_ENABLED() As Boolean
|
|
||||||
Get
|
|
||||||
Return CType(Me("JOB_ADSYNC_ENABLED"),Boolean)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
|
||||||
Public ReadOnly Property DB_DATASOURCE() As String
|
|
||||||
Get
|
|
||||||
Return CType(Me("DB_DATASOURCE"),String)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
|
||||||
Public ReadOnly Property DB_DATABASE() As String
|
|
||||||
Get
|
|
||||||
Return CType(Me("DB_DATABASE"),String)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
|
||||||
Public ReadOnly Property DB_USER() As String
|
|
||||||
Get
|
|
||||||
Return CType(Me("DB_USER"),String)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
|
||||||
Public ReadOnly Property DB_PASSWORD() As String
|
|
||||||
Get
|
|
||||||
Return CType(Me("DB_PASSWORD"),String)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("120")> _
|
|
||||||
Public ReadOnly Property JOB_INTERVAL() As Long
|
|
||||||
Get
|
|
||||||
Return CType(Me("JOB_INTERVAL"),Long)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("120")> _
|
|
||||||
Public ReadOnly Property JOB_ADSYNC_INTERVAL() As Long
|
|
||||||
Get
|
|
||||||
Return CType(Me("JOB_ADSYNC_INTERVAL"),Long)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||||
@ -147,9 +66,54 @@ Namespace My
|
|||||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||||
Public ReadOnly Property DB_CONNECTIONSTRING() As String
|
Public ReadOnly Property LOG_PATH() As String
|
||||||
Get
|
Get
|
||||||
Return CType(Me("DB_CONNECTIONSTRING"),String)
|
Return CType(Me("LOG_PATH"),String)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||||
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
|
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||||
|
Public ReadOnly Property SQL_CONNECTIONSTRING() As String
|
||||||
|
Get
|
||||||
|
Return CType(Me("SQL_CONNECTIONSTRING"),String)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||||
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
|
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||||
|
Public ReadOnly Property FIREBIRD_SERVER() As String
|
||||||
|
Get
|
||||||
|
Return CType(Me("FIREBIRD_SERVER"),String)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||||
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
|
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||||
|
Public ReadOnly Property FIREBIRD_DATABASE() As String
|
||||||
|
Get
|
||||||
|
Return CType(Me("FIREBIRD_DATABASE"),String)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||||
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
|
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||||
|
Public ReadOnly Property FIREBIRD_USER() As String
|
||||||
|
Get
|
||||||
|
Return CType(Me("FIREBIRD_USER"),String)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||||
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
|
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||||
|
Public ReadOnly Property FIREBIRD_PASSWORD() As String
|
||||||
|
Get
|
||||||
|
Return CType(Me("FIREBIRD_PASSWORD"),String)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
End Class
|
End Class
|
||||||
27
Service.JobRunner/My Project/Settings.settings
Normal file
27
Service.JobRunner/My Project/Settings.settings
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
|
||||||
|
<Profiles />
|
||||||
|
<Settings>
|
||||||
|
<Setting Name="JOB_ADSYNC_ROOT_PATH" Type="System.String" Scope="Application">
|
||||||
|
<Value Profile="(Default)" />
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="LOG_PATH" Type="System.String" Scope="Application">
|
||||||
|
<Value Profile="(Default)" />
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="SQL_CONNECTIONSTRING" Type="System.String" Scope="Application">
|
||||||
|
<Value Profile="(Default)" />
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="FIREBIRD_SERVER" Type="System.String" Scope="Application">
|
||||||
|
<Value Profile="(Default)" />
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="FIREBIRD_DATABASE" Type="System.String" Scope="Application">
|
||||||
|
<Value Profile="(Default)" />
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="FIREBIRD_USER" Type="System.String" Scope="Application">
|
||||||
|
<Value Profile="(Default)" />
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="FIREBIRD_PASSWORD" Type="System.String" Scope="Application">
|
||||||
|
<Value Profile="(Default)" />
|
||||||
|
</Setting>
|
||||||
|
</Settings>
|
||||||
|
</SettingsFile>
|
||||||
76
Service.JobRunner/My Project/app.manifest
Normal file
76
Service.JobRunner/My Project/app.manifest
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<!-- UAC-Manifestoptionen
|
||||||
|
Wenn Sie die Ebene der Benutzerkontensteuerung für Windows ändern möchten, ersetzen Sie den
|
||||||
|
Knoten "requestedExecutionLevel" wie folgt.
|
||||||
|
|
||||||
|
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||||
|
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||||
|
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||||
|
|
||||||
|
Durch Angabe des Elements "requestedExecutionLevel" wird die Datei- und Registrierungsvirtualisierung deaktiviert.
|
||||||
|
Entfernen Sie dieses Element, wenn diese Virtualisierung aus Gründen der Abwärtskompatibilität
|
||||||
|
für die Anwendung erforderlich ist.
|
||||||
|
-->
|
||||||
|
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||||
|
</requestedPrivileges>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
|
|
||||||
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
|
<application>
|
||||||
|
<!-- Eine Liste der Windows-Versionen, unter denen diese Anwendung getestet
|
||||||
|
und für die sie entwickelt wurde. Wenn Sie die Auskommentierung der entsprechenden Elemente aufheben,
|
||||||
|
wird von Windows automatisch die kompatibelste Umgebung ausgewählt. -->
|
||||||
|
|
||||||
|
<!-- Windows Vista -->
|
||||||
|
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 7 -->
|
||||||
|
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 8 -->
|
||||||
|
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 8.1 -->
|
||||||
|
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 10 -->
|
||||||
|
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||||
|
|
||||||
|
</application>
|
||||||
|
</compatibility>
|
||||||
|
|
||||||
|
<!-- Gibt an, dass die Anwendung mit DPI-Werten kompatibel ist und von Windows nicht automatisch auf höhere
|
||||||
|
DPI-Werte skaliert wird. WPF-Anwendungen (Windows Presentation Foundation) sind automatisch mit DPI-Werten kompatibel und müssen sich nicht
|
||||||
|
anmelden. Für Windows Forms-Anwendungen für .NET Framework 4.6, die sich für diese Einstellung anmelden, muss
|
||||||
|
auch die Einstellung "'EnableWindowsFormsHighDpiAutoResizing" in der "app.config" auf "true" festgelegt werden. -->
|
||||||
|
<!--
|
||||||
|
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<windowsSettings>
|
||||||
|
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||||
|
</windowsSettings>
|
||||||
|
</application>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- Designs für allgemeine Windows-Steuerelemente und -Dialogfelder (Windows XP und höher) aktivieren -->
|
||||||
|
<!--
|
||||||
|
<dependency>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity
|
||||||
|
type="win32"
|
||||||
|
name="Microsoft.Windows.Common-Controls"
|
||||||
|
version="6.0.0.0"
|
||||||
|
processorArchitecture="*"
|
||||||
|
publicKeyToken="6595b64144ccf1df"
|
||||||
|
language="*"
|
||||||
|
/>
|
||||||
|
</dependentAssembly>
|
||||||
|
</dependency>
|
||||||
|
-->
|
||||||
|
|
||||||
|
</assembly>
|
||||||
47
Service.JobRunner/ProjectInstaller.Designer.vb
generated
Normal file
47
Service.JobRunner/ProjectInstaller.Designer.vb
generated
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<System.ComponentModel.RunInstaller(True)> Partial Class ProjectInstaller
|
||||||
|
Inherits System.Configuration.Install.Installer
|
||||||
|
|
||||||
|
'Installer überschreibt den Löschvorgang zum Bereinigen der Komponentenliste.
|
||||||
|
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||||
|
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||||
|
Try
|
||||||
|
If disposing AndAlso components IsNot Nothing Then
|
||||||
|
components.Dispose()
|
||||||
|
End If
|
||||||
|
Finally
|
||||||
|
MyBase.Dispose(disposing)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'Wird vom Komponenten-Designer benötigt.
|
||||||
|
Private components As System.ComponentModel.IContainer
|
||||||
|
|
||||||
|
'Hinweis: Die folgende Prozedur ist für den Komponenten-Designer erforderlich.
|
||||||
|
'Das Bearbeiten ist mit dem Komponenten-Designer möglich.
|
||||||
|
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
||||||
|
<System.Diagnostics.DebuggerStepThrough()>
|
||||||
|
Private Sub InitializeComponent()
|
||||||
|
Me.ServiceProcessInstaller = New System.ServiceProcess.ServiceProcessInstaller()
|
||||||
|
Me.ServiceInstaller = New System.ServiceProcess.ServiceInstaller()
|
||||||
|
'
|
||||||
|
'ServiceProcessInstaller
|
||||||
|
'
|
||||||
|
Me.ServiceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem
|
||||||
|
Me.ServiceProcessInstaller.Password = Nothing
|
||||||
|
Me.ServiceProcessInstaller.Username = Nothing
|
||||||
|
'
|
||||||
|
'ServiceInstaller
|
||||||
|
'
|
||||||
|
Me.ServiceInstaller.DelayedAutoStart = True
|
||||||
|
Me.ServiceInstaller.DisplayName = "Digital Data Job Runner"
|
||||||
|
Me.ServiceInstaller.ServiceName = "DDJobRunner"
|
||||||
|
'
|
||||||
|
'ProjectInstaller
|
||||||
|
'
|
||||||
|
Me.Installers.AddRange(New System.Configuration.Install.Installer() {Me.ServiceProcessInstaller, Me.ServiceInstaller})
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Friend WithEvents ServiceProcessInstaller As ServiceProcess.ServiceProcessInstaller
|
||||||
|
Friend WithEvents ServiceInstaller As ServiceProcess.ServiceInstaller
|
||||||
|
End Class
|
||||||
129
Service.JobRunner/ProjectInstaller.resx
Normal file
129
Service.JobRunner/ProjectInstaller.resx
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="ServiceProcessInstaller.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>22, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="ServiceInstaller.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>197, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>False</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
||||||
16
Service.JobRunner/ProjectInstaller.vb
Normal file
16
Service.JobRunner/ProjectInstaller.vb
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
Imports System.ComponentModel
|
||||||
|
Imports System.Configuration.Install
|
||||||
|
|
||||||
|
Public Class ProjectInstaller
|
||||||
|
|
||||||
|
Public Sub New()
|
||||||
|
MyBase.New()
|
||||||
|
|
||||||
|
'Dieser Aufruf ist für den Komponenten-Designer erforderlich.
|
||||||
|
InitializeComponent()
|
||||||
|
|
||||||
|
'Initialisierungscode nach dem Aufruf von InitializeComponent hinzufügen
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
End Class
|
||||||
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="NLog" version="4.5.11" targetFramework="net461" />
|
<package id="NLog" version="4.6.2" targetFramework="net461" />
|
||||||
<package id="Quartz" version="3.0.7" targetFramework="net461" />
|
<package id="Quartz" version="3.0.7" targetFramework="net461" />
|
||||||
</packages>
|
</packages>
|
||||||
Loading…
x
Reference in New Issue
Block a user