Click here to Skip to main content
16,008,010 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Windows Service Pin
Xiangyang Liu 刘向阳15-Jul-03 1:41
Xiangyang Liu 刘向阳15-Jul-03 1:41 
GeneralRe: Windows Service Pin
Xiangyang Liu 刘向阳15-Jul-03 1:50
Xiangyang Liu 刘向阳15-Jul-03 1:50 
GeneralRe: Windows Service Pin
Xiangyang Liu 刘向阳15-Jul-03 1:59
Xiangyang Liu 刘向阳15-Jul-03 1:59 
GeneralRe: Windows Service Pin
Xiangyang Liu 刘向阳15-Jul-03 2:04
Xiangyang Liu 刘向阳15-Jul-03 2:04 
GeneralRe: Windows Service Pin
Heath Stewart15-Jul-03 5:15
protectorHeath Stewart15-Jul-03 5:15 
GeneralRe: Windows Service Pin
Heath Stewart15-Jul-03 8:46
protectorHeath Stewart15-Jul-03 8:46 
GeneralRe: Windows Service Pin
Heath Stewart15-Jul-03 12:44
protectorHeath Stewart15-Jul-03 12:44 
GeneralRe: Windows Service Pin
Heath Stewart16-Jul-03 9:04
protectorHeath Stewart16-Jul-03 9:04 
Parameters are not stored in the registry - registry keys are stored in the registry. Parameters and settings are not the same thing. Yes, you can - in Main - query the registry for settings, but parameters are passed TO main, and only the executable loader does that, beings that it's the entry point and not just a function (at least when the executable is loading).

There is nothing wrong with storing settings in the registry and reading them from the registry in Main, but it is recommended (RTFD!) to do everything in OnStart. This follows the .NET model of OOP since the entry point doesn't necessarily have to be in the ServiceBase-derived class. It could be anywhere. The SCM doesn't use the entry point at all - the executable loader does. The ServiceBase class is a wrapper of sorts that the SCM does - indirectly - use. This is the point I've been trying to make. You do know what RTFD means, right? It's all in there, both in the .NET documentation and a lot in the Platform SDK for Win32. You shouldn't rely on the entry point (Main in C#, for example).

So, read your settings from the registry or from the .NET config file (which is preferred over the registry for .NET applications for many reasons), or from a database or INI file - it doesn't matter! Just don't confuse parameters with settings and make sure you know how the SCM passes parameters.

 

Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN

GeneralRe: Windows Service Pin
Heath Stewart16-Jul-03 13:26
protectorHeath Stewart16-Jul-03 13:26 
GeneralRe: Windows Service Pin
Valeria Bogdevich17-Jul-03 4:46
Valeria Bogdevich17-Jul-03 4:46 
GeneralDirectShow .NET HELP!!! Pin
Brian JR14-Jul-03 8:15
Brian JR14-Jul-03 8:15 
GeneralRe: DirectShow .NET HELP!!! Pin
Heath Stewart15-Jul-03 8:50
protectorHeath Stewart15-Jul-03 8:50 
GeneralRe: DirectShow .NET HELP!!! Pin
Brian JR15-Jul-03 17:50
Brian JR15-Jul-03 17:50 
GeneralRe: DirectShow .NET HELP!!! Pin
J. Dunlap15-Jul-03 18:03
J. Dunlap15-Jul-03 18:03 
GeneralRe: DirectShow .NET HELP!!! Pin
Brian JR16-Jul-03 8:58
Brian JR16-Jul-03 8:58 
GeneralRe: DirectShow .NET HELP!!! Pin
J. Dunlap17-Jul-03 8:41
J. Dunlap17-Jul-03 8:41 
GeneralRe: DirectShow .NET HELP!!! Pin
Brian JR17-Jul-03 8:57
Brian JR17-Jul-03 8:57 
GeneralRe: DirectShow .NET HELP!!! Pin
J. Dunlap17-Jul-03 11:50
J. Dunlap17-Jul-03 11:50 
GeneralRe: DirectShow .NET HELP!!! Pin
Heath Stewart16-Jul-03 4:56
protectorHeath Stewart16-Jul-03 4:56 
GeneralRe: DirectShow .NET HELP!!! Pin
Brian JR16-Jul-03 9:10
Brian JR16-Jul-03 9:10 
GeneralRe: DirectShow .NET HELP!!! Pin
Heath Stewart16-Jul-03 9:21
protectorHeath Stewart16-Jul-03 9:21 
GeneralRe: DirectShow .NET HELP!!! Pin
Brian JR16-Jul-03 15:40
Brian JR16-Jul-03 15:40 
GeneralRe: DirectShow .NET HELP!!! Pin
Heath Stewart17-Jul-03 1:21
protectorHeath Stewart17-Jul-03 1:21 
GeneralRe: DirectShow .NET HELP!!! Pin
Brian JR17-Jul-03 8:49
Brian JR17-Jul-03 8:49 
GeneralRe: DirectShow .NET HELP!!! Pin
Heath Stewart17-Jul-03 8:51
protectorHeath Stewart17-Jul-03 8:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.