Remoting General host in Windows service.
Create a new Windows service, write the following code in the onStart method:
protected override void onstart (String [] ARGS)
{
// Todo: Add code to start the service here.
Eventlog mylog = new eventlog ();
MyLog.Source = "MONTHLISTSERVICE";
BOOL FAILED = FALSE;
Try
{
RemotingConfiguration.configure (@ "MontHservice.exe.config");
MyLog.WriteEntry ("Successfully Configure from the configuration file Montservice.exe.config!");
}
Catch (Exception EX)
{
MYLOG.WRITEENTRY ("Configuration Fail" EX.MESSAGE, EVENTLOGENTRYTYPE.ERROR);
Failed = true;
}
IF (failed == true)
{
// MessageBox.
}
}
The contents of the configuration file MONTHSERVICE.EXE.CONFIG are as follows, because there is a configured Channel et al., So use the Channel Ref = "TCP Server" port = "8085" to reference the settings in Machine.config.
channels>
service>
application>
configure>
Use InstallUnit ExefilePath to register to the Windows service.
xmp>