I want to launch an exe located in network from an asp.net web page.
when i compile my project and run it locally it works. But when deployed in server, its not able to get to the network location.
like my executable is at \\msdatadomain1\production\conversion.exe
here is what I have
try
{
if (!File.Exists(Tools.ConversionExecutable))
throw (new System.IO.FileNotFoundException("File Not Found " +
Tools.ConversionExecutable));
ProcessStartInfo startInfo = new ProcessStartInfo(Tools.ConversionExecutable);
startInfo.Arguments = @"-univName " + _context.LegalType +
@" -sourceFolder " + Tools.GetFolderName(_context.Source) +
@" -targetFolder " + Tools.GetFolderName(_context.Target) +
@" -univFile " + _context.Universe +
@" -xslt " + _context.Xslt +
@" -logFile " + _context.Log;
if (_context.Universe == "")
startInfo.Arguments = startInfo.Arguments.Replace(" -univFile", "");
Process process = Process.Start(startInfo);
process.WaitForExit();
}
I have also used impersonate option in web.config file.
Thanks in Advance.
Loading
VulpesPosted Dec 12, 2011, 6:34 PM
To start a process on a remote machine, you'll need to either use WMI or the free tool PsExec. Don't be surprised though if you run into 'access denied' errors when using WMI.
Check out this thread for more details:
http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/2b714d4f-92c1-4bd3-8ff1-226a278d129c/