0

I have a Window Service thats hosts wcf:

protected override void OnStart(string[] args)
{
    if (serviceHost != null)
    {
        serviceHost.Close();
    }
    serviceHost = new ServiceHost(typeof('myservicetype'));
        NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
        serviceHost.AddServiceEndpoint
            (typeof('myservicetype'),
            binding, ConfigurationManager.AppSettings["myconfig"]
            );
        serviceHost.Open();
        Console.ReadLine();
}

the wcf listen to requests, one of the request is to open notepad on the server,
this doesnt work because the service is running on session 0(no gui...),
how can i fix this?

dsolimano
  • 8,870
  • 3
  • 48
  • 63
user1763180
  • 115
  • 11

1 Answers1

0

You can open notepad regardless of what you're using (windows app, service etc) if the identity associated with the service got enough permissions. You can then use Process.Start("notepad.exe", yourTextFile);

Or just Process.Start(yourTextFile); if notepad is the default program for handling text files.

Giorgio Minardi
  • 2,765
  • 1
  • 15
  • 11