I am developping a server with geniune channel in a windows service , it seems that it's not as simple as the console application. When the thread that creates the server finishes his job , all variables that were declared in the thread scope are destroyed so the client cannot connect to that server anymore. With Console application we can avoid that with console.readline() but it's not the same case for windows service. So the first block of code is for windows service thread that creates the server and the second one is for the console application.
public void startServer()
{
System.Configuration.ConfigurationSettings.GetConfig("DNS");
GenuineGlobalEventProvider.GenuineChannelsGlobalEvent += new GenuineChannelsGlobalEventHandler(GenuineChannelsEventHandler);
var Path = AppDomain.CurrentDomain.BaseDirectory;
RemotingConfiguration.Configure(Path + "Server.exe.config");
RemotingServices.Marshal(new Agent(), "Server.rem");
}
static void Main(string[] args)
{
System.Configuration.ConfigurationSettings.GetConfig("DNS");
GenuineGlobalEventProvider.GenuineChannelsGlobalEvent += new GenuineChannelsGlobalEventHandler(GenuineChannelsEventHandler);
var Path = AppDomain.CurrentDomain.BaseDirectory;
RemotingConfiguration.Configure(Path + "Server.exe.config");
RemotingServices.Marshal(new Agent(), "Server.rem");
Console.ReadLine();
}
Have I missed somthing ? How can i achieve the availability of the server ?