hi,
I created WIndowsService to host SAO object. Everything was ok before,
but when I get back to it a few days ago i realized that it doesn't
work properly. So what I did wrong? Service host remote object so it
has work to do and service shouldn't be stopped.
The only solution I see is to create Thread with simple loop to keep my
service runing - but I know it's bad solution. Please help me with my
problem.
Piece of sourcecode:
internal partial class Server : ServiceBase
{
private TcpServerChannel chan;
private ChainingDeamon chainingDeamon;
public Server()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
try
{
this.NetInterfaceSetup();
}
catch (Exception e)
{
MessageBox.Show(e.Message, "DesServer Startup Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
this.Stop();
}
chainingDeamon = new
ChainingDeamon(Application.StartupPath);
}
protected override void OnStop()
{
}
private void NetInterfaceSetup()
{
this.chan = new TcpServerChannel(48004);
ChannelServices.RegisterChannel(chan, true);
RemotingConfiguration.ApplicationName = "DesServer";
RemotingConfiguration.RegisterWellKnownServiceType(typeof(DesServer.AdminProviderFactory),
"DesServer.AdminProviderFactory", WellKnownObjectMode.SingleCall);
}
}
regards
Martin Dz