1

I'm trying to write a program that can stop and start services using SilverLight 3 and VS2010. I can't add the reference to the System.ServiceProcess dll. C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.ServiceProcess.dll

1st why? - It it just a security precaution? 2- Is there a work around? Does SilverLight have a different library that I can use to start and stop services.

Also note that this is a desktop application and not a web app. It will be sitting on my desktop to toggle services on and off.

Brad8118
  • 4,672
  • 11
  • 36
  • 48

2 Answers2

0

Yes, it's a security precaution. Can you imagine the havoc Silverlight apps could cause on a system if they could start/stop services at will?

No, there is no work around, and for that I rest easier at night.

Have you considered writing a full-trust XBAP instead? I don't know if that would work for your situation, but I'd imagine a full-trust XBAP would be able to start/stop services. Or even a standard WPF desktop app? Why use Silverlight for this?


Edit: I'm really not sure if a full-trust XBAP would be able to do that, it's just something worth investigating, I think.

Rob
  • 25,984
  • 32
  • 109
  • 155
  • This should be a simple app and I figured it would be a good project for a 1st silverlight app. – Brad8118 Mar 24 '10 at 12:27
  • Right, but it's just not possible with Silverlight. – Rob Mar 24 '10 at 12:54
  • Is no more insecure than any other application starting and stopping services. It's not like any application can just connect to the SCM and do things; it needs to be authorised first. – Peter Ritchie May 15 '11 at 15:38
0

The only way to achieve this, if you absolutely need silverlight is to:

Create a WCF Service that must be installed on the machine you wish to start/stop services on. Then through silverlight call the WCF service and ask it to start/stop services.

Neil
  • 1,912
  • 17
  • 24