草庐IT

DETACH_PROCESS

全部标签

c# - asp.net下的Process.Start()?

根据msdn:ASP.NETWebpageandservercontrolcodeexecutesinthecontextoftheASP.NETworkerprocessontheWebserver.IfyouusetheStartmethodinanASP.NETWebpageorservercontrol,thenewprocessexecutesontheWebserverwithrestrictedpermissions.Theprocessdoesnotstartinthesamecontextastheclientbrowser,anddoesnothaveaccesst

c# - 从 Windows 服务调用时,Process.Start 不起作用

在Windows8上,我正在运行一个Windows服务。该服务应该通过启动一个程序Process.Start(exePath);但是进程会立即退出——甚至Main过程中的第一行也不会执行。以前,在Windows7上的相同服务中运行相同进程时,一切正常。如何让它重新工作?如何从Windows服务正确启动进程? 最佳答案 找到解决方案。流程必须像这样开始:ProcessStartInfoinfo=newProcessStartInfo(exePath);info.CreateNoWindow=true;info.UseShellExec

c# - SOAP 错误 : "Server was unable to process request" "Object reference not set to an instance of an object"

当我向本地IIS中的服务发送SOAP请求时,一切正常。当我向在另一台主机上的IIS上运行的同一服务发送SOAP请求时,一切正常。但是当另一个程序员向我的服务发送SOAP请求时,他通常会得到正确的响应,除了返回服务中的一个方法:soap:ServerServerwasunabletoprocessrequest.--->Objectreferencenotsettoaninstanceofanobject.我需要了解他收到此错误的原因。他的SOAP请求与SOAP请求完全相同,但我的有效,而他的无效。 最佳答案 如果您不确切知道错

c# - 为什么即使进程确实存在,Process.WaitForExit 也会抛出 "no process"异常?

我有一个包含此代码的Windows服务:publicstaticvoidExtractTextInner(stringsource,stringdestination){ProcessStartInfostartInfo=newProcessStartInfo();startInfo.FileName=EXTRACTOR_EXE_FILEPATHstartInfo.Arguments="\""+source+"\"\""+destination+"\"";startInfo.CreateNoWindow=true;startInfo.WindowStyle=ProcessWindowS

c# - 在什么情况下 Process.Start() 方法会返回 false?

来自MSDN:Thereturnvaluetrueindicatesthatanewprocessresourcewasstarted.IftheprocessresourcespecifiedbytheFileNamememberoftheStartInfopropertyisalreadyrunningonthecomputer,noadditionalprocessresourceisstarted.Instead,therunningprocessresourceisreusedandfalseisreturned.尝试这样的事情:varinfo=newProcessStart

C# Process.MainWindowHandle 总是返回 IntPtr 零

这是我的代码:using(Processgame=Process.Start(newProcessStartInfo(){FileName="DatabaseCheck.exe",RedirectStandardOutput=true,CreateNoWindow=true,UseShellExecute=false})){lblLoad.Text="Loading";intSwitch=0;while(game.MainWindowHandle==IntPtr.Zero){Switch++;if(Switch%1000==0){lblLoad.Text+=".";if(lblLoad

c# - process.standardoutput.ReadToEnd() 总是空的?

我正在启动一个控制台应用程序,但是当我重定向标准输出时,我总是什么也得不到!当我不重定向它,并将CreateNoWindow设置为false时,我在控制台中正确地看到了所有内容,但是当我重定向它时,StandardOutput。ReadToEnd()始终返回一个空字符串。Processcproc=newProcess();cproc.StartInfo.CreateNoWindow=true;cproc.StartInfo.FileName=Dest;cproc.StartInfo.RedirectStandardOutput=true;cproc.StartInfo.WindowSt

c# - 当 UAC 被拒绝时,Process.Start 永远不会返回

我有一个更新程序exe,用于关闭主exe,用更新的exe替换它,然后启动更新的exe。当更新程序尝试启动更新的exe时,如果UAC权限对话框被用户拒绝,更新程序将挂起。这是因为Process.Start()函数永远不会返回。顺便说一下,我的CPU周期表显示几乎没有使用。我希望我所有的用户都对UAC说"is",但既然我在这里,我想至少用某种错误消息来处理这种情况。假设我的用户至少拥有Windows7。exe本身是32位Winforms应用程序。目标.NetFramework是4.0。使用VisualStudio2010Ultimate。关于如何检测我的用户何时拒绝UAC对话框的任何想法?

c# - C# 中的 Process 和 ProcessStartInfo 有什么区别?

Process和ProcessStartInfo有什么区别?我用过这两种方法来启动外部程序,但必须有一个原因有两种方法可以做到这一点。这里有两个例子。ProcessnotePad=newProcess();notePad.StartInfo.FileName="notepad.exe";notePad.StartInfo.Arguments="ProcessStart.cs";notePad.Start();和ProcessStartInfostartInfo=newProcessStartInfo();startInfo.FileName="notepad.exe";startInf

c# - 升级 .NET Framework 后 VS2010 出现 "Unable to step. Process is not synchronized"错误

我在Windows7桌面上安装了VisualStudio2010,主要用于调试ASP.NET解决方案。一切都运行良好,直到其中一个Windows更新安装了新版本的.NETFramework。现在,当我尝试放置断点然后在我的C#代码中执行“调试器步骤”时,我收到以下消息:更糟糕的是,它不会一直发生。我试图找到任何模式,但我能描述的最好方式是零星的。知道如何解决这个问题吗? 最佳答案 我刚在VisualStudio2015中得到这个。我在一个单独的线程上调试,遇到断点但无法继续。重新启动并没有解决它。我删除了所有断点,重置了我真正想要的