Make the RADIUS server runnable from Visual Studio.

In other words, make it runnable not only as a service.
This commit is contained in:
Jakob A. Dam 2015-03-27 10:06:05 +01:00 committed by Jakob Aarøe Dam
parent 249ae5818b
commit 3402587bae
2 changed files with 13 additions and 5 deletions

View file

@ -19,7 +19,7 @@ Partial Class CICRadarR
' The main entry point for the process ' The main entry point for the process
<MTAThread()> _ <MTAThread()> _
<System.Diagnostics.DebuggerNonUserCode()> _ <System.Diagnostics.DebuggerNonUserCode()> _
Shared Sub Main() Shared Sub Main(ByVal args() As String)
Dim ServicesToRun() As System.ServiceProcess.ServiceBase Dim ServicesToRun() As System.ServiceProcess.ServiceBase
' More than one NT Service may run within the same process. To add ' More than one NT Service may run within the same process. To add
@ -28,9 +28,17 @@ Partial Class CICRadarR
' '
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService} ' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
' '
ServicesToRun = New System.ServiceProcess.ServiceBase() {New CICRadarR} Dim server = New CICRadarR()
System.ServiceProcess.ServiceBase.Run(ServicesToRun) If Environment.UserInteractive Then
server.OnStart(args)
Console.WriteLine("Type any character to exit")
Console.Read()
server.OnStop()
Else
ServicesToRun = New System.ServiceProcess.ServiceBase() {server}
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
End If
End Sub End Sub
'Required by the Component Designer 'Required by the Component Designer

View file

@ -8,8 +8,8 @@
<SchemaVersion> <SchemaVersion>
</SchemaVersion> </SchemaVersion>
<ProjectGuid>{04C6C533-9FEA-41B2-B554-A166C7C7FE32}</ProjectGuid> <ProjectGuid>{04C6C533-9FEA-41B2-B554-A166C7C7FE32}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>Exe</OutputType>
<StartupObject>CICRadarR.CICRadarR</StartupObject> <StartupObject>Sub Main</StartupObject>
<RootNamespace>CICRadarR</RootNamespace> <RootNamespace>CICRadarR</RootNamespace>
<AssemblyName>CICRadarR</AssemblyName> <AssemblyName>CICRadarR</AssemblyName>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>