views:

153

answers:

2

Our mysql instance occaisionally locks up during backups. Currently we must VPN into the corporate network (to obtain work I.P.), remote desktop into the server, open the task manager, and manually kill the mysqld-nt.exe process.

Instead of doing all of this we are attempting to create a simple webpage that we can log into to kill and restart the service.

The following block of code is wired up inside our new .aspx page works as I intended on my local desktop (running in VS debug mode), but doesn't do anything when pushed to the server (no errors or anything):

Process myProcess = new Process();
ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("taskkill");
myProcessStartInfo.Arguments = "/IM mysqld-nt.exe /F";
myProcessStartInfo.UseShellExecute = false;
myProcessStartInfo.RedirectStandardOutput = true;
myProcessStartInfo.CreateNoWindow = true;
myProcess.StartInfo = myProcessStartInfo;
myProcess.Start();
myProcess.Close();

If I run "taskkill /IM mysqld-nt.exe /F" from the command prompt on the server it kills the service. So I think it might be a permissions issue, but I'm not positive.

Can anyone spot something wrong with the code block above, or tell me how to adjust the permissions so .Net can stop/start this process?

Thanks for the help, Sam

A: 

It sounds like your page is probably running as the IUSR_MACHINE account (with limited permissions).

On your development machine, it's your account which starts the dev web server process, and you're probably logged in as a local administrator.

Make IIS ask you for a password, and turn on impersonation Then try logging in as an administrator (or some account with privileges).

Seth
Thanks for the response Seth. I double checked and .Net runs under "NETWORK SERVICE" on our Windows Server 2003. I tried impersonating the account I remote in with and still had no luck. I was able to verify that I was impersonating the account correctly by using "<%= Environment.UserName %>" to output the value.I also tried going into the Services and tried checking the box to allow interaction with the desktop for World Wide Web Publishing...still no luck, even after restarting the service.Any other thoughts or recommendations? Anybody else succesfully interacting w/ desktop or cmd?
Sam
My only other thought was that it might be a user interaction restriction. See: http://support.microsoft.com/kb/555134
Seth
Yeah, I tried that stuff too without any luck.
Sam
Ah, the joys of working with IIS.
Seth
Ahh, the joy :( Not sure what else to try.
Sam
A: 

This might be late, but did u check the network port(s) on the remote machine?

del.ave
It was on the same box. Ended up changing the way we do backups which eliminated the need for stopping/starting MySQL from an ASPX page. Now we use a batch file to stop IIS, drop all connections to MySQL, run the backup, then fire it all back up again.
Sam