Can I Wake On Lan my remote computer through a webservice?
I have an application which is running on a remote machine. The only contact with the application is through a webservice, i can send it a command to shut down - but how do i start it again? I would like to have a scheduling type of service where i have a windows service on my machine and at 08:00 am it sends a startup command thro开发者_JAVA技巧ugh the webservice(??) and at 04:00 pm it sends a shutdown command through the webservice. The shutdown i can do, but the wake on lan thing - because its not a lan, its potentionally the internet - any suggestions?
cheers,
You won't be able to wake your remote machine up using a web service call to your actual machine you want to wake up. You will have to send it a 'magic' packet.
Luckily there are a bunch of tools and utilities out there that allow you to do this quite easily.
Check out wolcmd.exe - that should do the trick for you.
Equally, there's nothing stopping you rolling your own client that sends the magic packet, if you are so inclined.
And if you want to run this from a web service (not located on the target machine obviously), you simply wrap wolcmd.exe
by using System.Diagnostics.Process.Start()
.
Here are two links that I googled on here and here. My take is that you'd need to connect to a remote lan via VPN passing through a firewall to be on the same subnet and similar ip address as where the webservice is running on! That should be secure enough and if you do that, only your machine can then be shut down remotely. My feeling is this - you'd need to be connected directly to the remote endpoint all the time...But at the top of my head, that sounds frankly impossible, as how will the remote endpoint know your ip address if your machine went to sleep...You need to be careful of certain drivers that will refuse to go to sleep and therefore preventing your machine from going to sleep. I happen to have a 3G mobile broadband, and my netbook refuses to sleep unless I shutdown the connection and unplug it (even if its still plugged in, it refuses to sleep!), the reason I say that, if you were to use VPN, and it went to sleep, then that connection is lost - that's my opinion of it. What do you think?
Hope this helps, Best regards, Tom.
If the web service is on a separate box on the same local LAN as the box which needs to be started, it should be possible to have a web service use Wake-on-LAN technology to start it.
精彩评论