windows services

  • Thread starter Thread starter Vuong
  • Start date Start date
V

Vuong

I just wrote a simple host application. Already tested.

After that i change it to a service. (I add new project to the exist host
application, copy code from this host application to OnStart() of the new
project )

Build with no error, use installutil to register it to Services. (Success)
However, I can't not start this services.

Error 1083 : the executable program that this service is configured to run
in does not implement the service.

Any help would be appreciate. If this is not clear enough (my poor english),
i can explain it again


Here my code

Host Application : (console)
EventLog myLog = new EventLog();

myLog.Source = "ListHost";

RemotingConfiguration.Configure(@"../../ListHost.exe.config");

myLog.WriteEntry("Configuration from ListHost.exe.cfg successful");

System.Console.WriteLine("Press [Enter] to exit...");

System.Console.ReadLine();

my XML file : (i copied my xml file and rename it for service into
windows\system32)

<configuration>

<System.Runtime.Remoting>

<application name="ListServer">

<service>

<wellknown mode="Singleton"
type="ListServer.CompanyList,ListServer" objectUri="CompanyLists"/>

</service>

<channels>

<channel ref="http" port="8080"/>

</channels>

</application>

<debug loadTypes="true" />

</System.Runtime.Remoting>

</configuration>

my OnStart in ListService.h :
EventLog myLog = new EventLog();

myLog.Source = "ListHost";

try

{

RemotingConfiguration.Configure("ListService.exe.config");

myLog.WriteEntry("Configuration from ListHost.exe.cfg successful");

}

catch (Exception e)

{

myLog.WriteEntry("Failed to configure host application: " +
e.Message,System.Diagnostics.EventLogEntryType.Error);


}


Thanks,
Nos
BG
 
Vuong,

I would check the documentation for the ServiceBase class. It will tell
you how to create a service, as well as define the entry point to run your
service(s).

Hope this helps.
 
Back
Top