c# - Specify LoaderOptimization's for Windows Services -


How do we specify the loader optimization when we are building a Windows service, we have our "main" method In other words, when we have a simple console application, we can use it:

  [loader optimization (multi-dotmost)] personal static wide Main (string [] arg) {}  

But for a service, We apply the servicebase class and therefore not the main method, instead we have

  protected override zero start (string [] arg) {}  

But I think that this method will not have the effect of putting the attribute?

You still have one main method for a Windows service, usually this is where you will call . For a Windows Service Project, the Visual Studio template will generate a program called a program that looks like this and contains the main () method:

  Fixed class program {/// & lt; Summary & gt; Main entry point for the application /// & lt; / Summary & gt; Static Zero Main () {ServiceBase] ServicesToron; ServicesToRun = New ServiceBase [] {New Service 1 ()}; ServiceBase.Run (ServicesToRun); }}  

You should be able to add a feature to the main () method there.


Comments