在ASP中打开进程时拒绝访问? [英] Access denied while open process in ASP ?

查看:207
本文介绍了在ASP中打开进程时拒绝访问?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好所有



在我使用c#代码发布我的asp.net web应用程序后无法打开进程或应用程序路径

hello all

unable to open process or application path after i publish my asp.net web application using c# code

Access is denied

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ComponentModel.Win32Exception: Access is denied

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[Win32Exception (0x80004005): Access is denied]
   System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) +6565246
   System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) +93
   System.Diagnostics.Process.Kill() +46





我尝试过:



这是我的代码:





What I have tried:

this is my code :

protected void btnTeamViewer_Click(object sender, ImageClickEventArgs e)
       {
           foreach (Process proc in Process.GetProcessesByName("TeamViewer"))
           {
               proc.Kill();
           }


           string Path = "";
           //PartnerIP = "-i 8.8.8.8 --Password test";
           string curFile = @"C:\Program Files\TeamViewer\Version7\TeamViewer.exe"; // 32bit
           //string curFile = @"C:\Program Files (x86)\TeamViewer\Version9\TeamViewer.exe"; // home
           if (File.Exists(curFile))
           {
               Path = @"C:\Program Files\TeamViewer\Version7\TeamViewer.exe"; // 32bit
               //Path = @"C:\Program Files (x86)\TeamViewer\Version9\TeamViewer.exe"; // home
               Process p = System.Diagnostics.Process.Start(Path, PartnerIP);
               Thread.Sleep(500); // Allow the process to open it's window

           }
           else
           {

               curFile = @"C:\Program Files (x86)\TeamViewer\Version7\TeamViewer.exe";
               if (File.Exists(curFile))
               {
                   Path = @"C:\Program Files (x86)\TeamViewer\Version7\TeamViewer.exe"; // 64bit
                   Process p = System.Diagnostics.Process.Start(Path, PartnerIP);
                   Thread.Sleep(500); // Allow the process to open it's window

               }
               else
               {

               }
           }
       }

推荐答案

这没有任何意义。



ASP .NET代码在服务器上运行完全,而不是在客户端上运行。这段代码试图在服务器上杀死TeamViewer。



因此,如果您希望此代码在客户端计算机上杀死TeamViewer,那么这不会起作用所有。



您也无法在客户端上终止进程,即使是在客户端获取的HTML页面中运行的javascript。



您也无法在客户端计算机上启动进程,也无法访问客户端文件系统。
This doesn't make any sense.

ASP.NET code runs ENTIRELY on the server, never on the clients. This code is trying to kill TeamViewer ON THE SERVER.

So, if you're expecting this code to kill TeamViewer on the client machines, that's not going to work at all.

You also cannot kill a process on a client, even from javascript running in the HTML page your clients get.

You also cannot launch processes on client machines, nor get access to the clients filesystem.


错误消息非常明确:您无权关闭所有TeamViewer进程那台电脑。



所以从调试器开始,找出你想要杀死的进程。然后使用任务管理器查找谁拥有该进程,如果它是一个你应该尝试杀死。



我们不能为你做到 - 我们根本无法访问您的机器!
The error message is pretty explicit: you do not have permission to close all TeamViewer processes on that computer.

So start with the debugger and find out exactly what process you are trying to kill. Then use the Task Manager to find who owns the process, and if it is one you should be trying to kill.

We can't do that for you - we have no access at all to your machine!


这篇关于在ASP中打开进程时拒绝访问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆