3

I have a WCF service hosted in a Windows service.

This service the WCF have one metohd and in this method I have one important line :

 Process Browser = Process.Start("iexplore.exe", hostUrl);

I install Windows service as local system, but when I'm trying to invoke that method, everything seems to execute, except that one important line... and IE didn't open.

I would like to add that the method itself is not in the service itself but in one of the service dll reference

Any idea why?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
MoShe
  • 6,197
  • 17
  • 51
  • 77

3 Answers3

4

http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/63a7d1ec-7077-489a-a250-f7422f04317b

" in order to get the service to actually show the UI, you'd have to set the service in Computer Management to allow it to interact with the desktop. In the services window in computer management, go to the properties of your service, and on the Log On tab, check "Allow service to interact with desktop" "

Mark W
  • 3,879
  • 2
  • 37
  • 53
3

Since Windows Vista MS has been adding lots of security-related changed esp. in the area what Windows Services can/can't do. Anything "desktop-like" (printing, accessing network shares, using Office Interop etc.) is harder and harder to get working.

You should rethink your design since IMHO any "server-like process" (for example a WCF service) can be accessed in parallel by multiple requests and thus should NOT use processes which are NOT designed for this type of interaction... what happens if your webservice starts multiple IE instances that way ? Will IE behave as you need/expect it ?

IF you really really MUST do it this way you should have

  • a normal desktop process hosting the WCF service

OR

  • two processes, one your Windows Service and one running as a normal desktop process dealing with IE... these two process communicate via IPC
Yahia
  • 69,653
  • 9
  • 115
  • 144
1

Under what user is the service running? Try running it under the currently logged in user, with privileges to interact with the desktop and see if that helps.

In general, its not a great idea to have services launching GUI processes. For example, what if no one is logged on. What if many people are logged on? Should it open in all sessions... etc. Have you considered exposing a simple (e.g. Net.NamedPipes) endpoint on your service, and writing a small client UI to interact with it?

Ryan Sorensen
  • 645
  • 7
  • 7