![]() |
Executing a program
I am trying to execute a program from my web page on a 2003 server.
Both the program and the web application are on the same server. The program normally runs as a scheduled task but we need to allow the inhouse users to be able to manually start the program which just reads a file and fills various tables with it. When I run it on my workstation, it works fine. We have a user defined to run the program and I am using impersonation to run the program. The problem is that it doesn't seem to execute on the server. Is there something special I need to set up this up? My code to execute the program is (with program containing the path and executable name): // Impersonate, automatically release the impersonation. using (new Impersonator("User", "server", "password")) { Process p = new Process(); p.StartInfo.FileName = program; p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = false; p.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; p.Start(); } This runs on my laptop running IIS without any problem (without the impersonation). Thanks, Tom |
Re: Executing a program
The errors I am getting in the event log are:
Event Type: Error Event Source: .NET Runtime 2.0 Error Reporting Event Category: None Event ID: 5000 Date: 10/13/2009 Time: 3:29:24 PM User: N/A Computer: OBERON Description: EventType clr20r3, P1 autoups.executable.exe, P2 1.0.0.0, P3 4ad3e1e5, P4 autoups.executable, P5 1.0.0.0, P6 4ad3e1e5, P7 1, P8 5f, P9 system.typeinitialization, P10 NIL. Event Type: Error Event Source: VsJITDebugger Event Category: None Event ID: 4096 Date: 10/13/2009 Time: 3:29:29 PM User: NT AUTHORITY\NETWORK SERVICE Computer: OBERON Description: An unhandled exception ('System.TypeInitializationException') occurred in AutoUPS.Executable.exe [3692]. Just-In-Time debugging this exception failed with the following error: Debugger could not be started because no user is logged on. Thanks, Tom "tshad" <toms@pdsa.com> wrote in message news:OvAV6OFTKHA.5052@TK2MSFTNGP06.phx.gbl... >I am trying to execute a program from my web page on a 2003 server. > > Both the program and the web application are on the same server. > > The program normally runs as a scheduled task but we need to allow the > inhouse users to be able to manually start the program which just reads a > file and fills various tables with it. > > When I run it on my workstation, it works fine. We have a user defined to > run the program and I am using impersonation to run the program. > > The problem is that it doesn't seem to execute on the server. > > Is there something special I need to set up this up? > > My code to execute the program is (with program containing the path and > executable name): > > // Impersonate, automatically release the impersonation. > > using (new Impersonator("User", "server", "password")) > { > Process p = new Process(); > p.StartInfo.FileName = program; > p.StartInfo.UseShellExecute = false; > p.StartInfo.CreateNoWindow = false; > p.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; > p.Start(); > } > > This runs on my laptop running IIS without any problem (without the > impersonation). > > Thanks, > > Tom > |
Re: Executing a program
"tshad" <toms@pdsa.com> wrote in message news:OvAV6OFTKHA.5052@TK2MSFTNGP06.phx.gbl... >I am trying to execute a program from my web page on a 2003 server. > > Both the program and the web application are on the same server. > > The program normally runs as a scheduled task but we need to allow the > inhouse users to be able to manually start the program which just reads a > file and fills various tables with it. > > When I run it on my workstation, it works fine. We have a user defined to > run the program and I am using impersonation to run the program. > > The problem is that it doesn't seem to execute on the server. > > Is there something special I need to set up this up? I would suggest looking up how to make an ASP.NET UI call a Windows NT Service and have the code in the WS or make the WS execute the exe in question. __________ Information from ESET NOD32 Antivirus, version of virus signature database 4504 (20091013) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com |
Re: Executing a program
while the thread starting a process needs enough permission to start
one, the new process will not run as the thread impersonation account, but rather as the process owner account (probably system on your workstation, but locked down on the server). you probably need the program to do the impersonation, also the default dir will be system32, not the vdir. -- bruce (sqlwork.com) tshad wrote: > I am trying to execute a program from my web page on a 2003 server. > > Both the program and the web application are on the same server. > > The program normally runs as a scheduled task but we need to allow the > inhouse users to be able to manually start the program which just reads a > file and fills various tables with it. > > When I run it on my workstation, it works fine. We have a user defined to > run the program and I am using impersonation to run the program. > > The problem is that it doesn't seem to execute on the server. > > Is there something special I need to set up this up? > > My code to execute the program is (with program containing the path and > executable name): > > // Impersonate, automatically release the impersonation. > > using (new Impersonator("User", "server", "password")) > { > Process p = new Process(); > p.StartInfo.FileName = program; > p.StartInfo.UseShellExecute = false; > p.StartInfo.CreateNoWindow = false; > p.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; > p.Start(); > } > > This runs on my laptop running IIS without any problem (without the > impersonation). > > Thanks, > > Tom > > |
Re: Executing a program
Actually, there is exception handling in it.
It seems to happen when trying to start the program before it gets to my TRY. On the web side, it just starts the program and goes on and assumes it started fine. Tom "Mark Rae [MVP]" <mark@markNOSPAMrae.net> wrote in message news:%23z3ZTFKTKHA.5164@TK2MSFTNGP02.phx.gbl... > "tshad" <toms@pdsa.com> wrote in message > news:OALy3oFTKHA.4980@TK2MSFTNGP06.phx.gbl... > >> Event Source: .NET Runtime 2.0 Error Reporting >> Event Source: VsJITDebugger > >> An unhandled exception ('System.TypeInitializationException') occurred in >> AutoUPS.Executable.exe [3692]. Just-In-Time debugging this exception >> failed with the following error: Debugger could not be started because no >> user is logged on. > > Pretty self-explanatory - "an exception has occurred but you don't have > any exception handling in your code so I can't tell you about it and > instead I'm going to try to launch the JIT Debugger so you can investigate > but unfortunately no user is logged for me to do this". > > Put some exception handling in your code, find the error, and then fix > it... > > > -- > Mark Rae > ASP.NET MVP > http://www.markrae.net |
Re: Executing a program
"Mr. Arnold" <MR. Arnold@Arnold.com> wrote in message news:efTZNTITKHA.220@TK2MSFTNGP02.phx.gbl... > > "tshad" <toms@pdsa.com> wrote in message > news:OvAV6OFTKHA.5052@TK2MSFTNGP06.phx.gbl... >>I am trying to execute a program from my web page on a 2003 server. >> >> Both the program and the web application are on the same server. >> >> The program normally runs as a scheduled task but we need to allow the >> inhouse users to be able to manually start the program which just reads a >> file and fills various tables with it. >> >> When I run it on my workstation, it works fine. We have a user defined >> to run the program and I am using impersonation to run the program. >> >> The problem is that it doesn't seem to execute on the server. >> >> Is there something special I need to set up this up? > > I would suggest looking up how to make an ASP.NET UI call a Windows NT > Service and have the code in the WS or make the WS execute the exe in > question. Actually, I will just have change the program to run as a WS and handle it from there. Thanks, Tom > > > __________ Information from ESET NOD32 Antivirus, version of virus > signature database 4504 (20091013) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > > |
Re: Executing a program
"bruce barker" <nospam@nospam.com> wrote in message news:eT3nzLNTKHA.4028@TK2MSFTNGP05.phx.gbl... > while the thread starting a process needs enough permission to start one, > the new process will not run as the thread impersonation account, but > rather as the process owner account (probably system on your workstation, > but locked down on the server). > > you probably need the program to do the impersonation, also the default > dir will be system32, not the vdir. > Not sure how I would do that. I am not running as a thread. I thought that Process would start a new process to run by itself. How would you give the credentials to the process (.exe) that would allow it to run. We already set up a specific User with enough permissions to run. And it works fine on my desktop machine, just won't work on the Server. Thanks, Tom > -- bruce (sqlwork.com) > > tshad wrote: >> I am trying to execute a program from my web page on a 2003 server. >> >> Both the program and the web application are on the same server. >> >> The program normally runs as a scheduled task but we need to allow the >> inhouse users to be able to manually start the program which just reads a >> file and fills various tables with it. >> >> When I run it on my workstation, it works fine. We have a user defined >> to run the program and I am using impersonation to run the program. >> >> The problem is that it doesn't seem to execute on the server. >> >> Is there something special I need to set up this up? >> >> My code to execute the program is (with program containing the path and >> executable name): >> >> // Impersonate, automatically release the impersonation. >> >> using (new Impersonator("User", "server", "password")) >> { >> Process p = new Process(); >> p.StartInfo.FileName = program; >> p.StartInfo.UseShellExecute = false; >> p.StartInfo.CreateNoWindow = false; >> p.StartInfo.WindowStyle = >> ProcessWindowStyle.Maximized; >> p.Start(); >> } >> >> This runs on my laptop running IIS without any problem (without the >> impersonation). >> >> Thanks, >> >> Tom |
| All times are GMT. The time now is 06:09 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.