来自 .ASPX 的 taskkill Mysql -- 权限问题?
我们的 mysql 实例在备份期间偶尔会锁定。目前我们必须VPN进入公司网络(获取工作IP),远程桌面进入服务器,打开任务管理器,并手动杀死mysqld-nt.exe进程。
我们没有做所有这些,而是尝试创建一个简单的网页,我们可以登录该网页来终止并重新启动服务。
以下代码块在我们的新 .aspx 页面中按照我的预期在本地桌面上工作(在 VS 调试模式下运行),但在推送到服务器时不执行任何操作(没有错误或任何内容):
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();
如果我从服务器上的命令提示符运行“taskkill /IM mysqld-nt.exe /F”,它会终止服务。所以我认为这可能是一个权限问题,但我并不肯定。
谁能发现上面的代码块有问题,或者告诉我如何调整权限,以便 .Net 可以停止/启动这个过程?
感谢您的帮助, 山姆
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听起来您的页面可能以 IUSR_MACHINE 帐户(权限有限)运行。
在您的开发计算机上,您的帐户启动开发 Web 服务器进程,并且您可能以本地管理员身份登录。
让 IIS 要求您输入密码,然后打开模拟 然后尝试以管理员身份登录 (或某些具有权限的帐户)。
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).
这可能会晚一些,但是您检查了远程计算机上的网络端口吗?
This might be late, but did u check the network port(s) on the remote machine?
无法找到解决方法来让它通过 ASP.net 工作。我很确定这是某种许可问题。最终使用由计划任务触发的批处理文件来停止/启动/备份 MySQL。
Wasn't able to figure out a work around to get it to work via ASP.net. I'm pretty sure it is a permission issue of some sort. Ended up using a batch file that is triggered by Scheduled Tasks to stop/start/backup MySQL.