I am trying to launch a command-line program that came with a program called Live Stats. This command-line program is used to automate configuration of Live Stats. In order to test this, I am just calling the program with no arguments, which just returns some "how to use" text, and requires no user input. The problem is that once I do a .start on the process, the program just hangs indefinitely. I can see it running in the process list on the server, using 0% CPU, but it never goes away. When I tried it with the arguments to actually change a setting, that setting never got changed. If I try doing a .StandardOutput .ReadToEnd (Or any other type of Read), or a .WaitForExit, then the ASP.NET page will hang as well. I took the exact same code I'm using in the ASP.NET page, and put it into a standard windows VB.NET app. I ran that app on the server, and it worked with no problems at all. In addition, using the same code in the ASP.NET page with a different app works just fine, so I know that it has something to do with the program I'm trying to run, but can't figure out what exactly it is. If anyone is willing to help me with this, I will gladly send you the program (It's only a 300kb single-file executable), to see if you're able to help. And, here is the code that I'm using (VB):
Dim siStartInfo As New ProcessStartInf o("ls6remote.ex e")
Dim pLSRemote As New Process
Dim strReturn as String
'Initialize Process properties
siStartInfo.Use ShellExecute = False
siStartInfo.Cre ateNoWindow = True
siStartInfo.Red irectStandardOu tput = True
pLSRemote = Process.Start(s iStartInfo)
strReturn = pLSRemote.Stand ardOutput.ReadT oEnd
Response.Write( strReturn)
pLSRemote.Close ()
--
Message posted via http://www.dotnetmonster.com 4 3582
Man, I can't believe I typoed in the topic. :/
Anyway, a little more info about the LS6Remote.exe. This program does connect to the Live Stats server via TCP. I'm not actually using it to connect to any servers in the code that I'm testing this with, but I guess it's possible that the app is trying to open a socket, anyway. I have no idea if this would make a difference or not (Does the ASP.NET worker process maybe not have permissions to open new sockets? Just grasping at straws, here).
Also, info about the environment of the server: Windows 2000 Server w/ SP4, IIS 5.0, and .NET 1.1 (No SP1 on it, yet). I am not using impersonation, and have verified that the ASPNET user has full control on ls6remote.exe (It is actually launching the process, so I don't think this might be considered an issue, but just in case).
--
Message posted via http://www.dotnetmonster.com
ASP.NET by default runs under the user account ASPNET.
Most likley, this user account does not have permissions to the file, or to
one of the resources that file is trying to access.
For testing purposes you can have it run under your personal user account
since you know your account has the necessary permissions.
Here's more info: http://msdn.microsoft.com/library/de...ersonation.asp
--
I hope this helps,
Steve C. Orr, MCSD, MVP http://Steve.Orr.net
"Jesse Cates via DotNetMonster.c om" <fo***@DotNetMo nster.com> wrote in
message news:60******** *************** *******@DotNetM onster.com... I am trying to launch a command-line program that came with a program called Live Stats. This command-line program is used to automate configuratio n of Live Stats. In order to test this, I am just calling the program with no arguments, which just returns some "how to use" text, and requires no user input. The problem is that once I do a .start on the process, the program just hangs indefinitely. I can see it running in the process list on the server, using 0% CPU, but it never goes away. When I tried it with the arguments to actually change a setting, that setting never got changed. If I try doing a .StandardOutput .ReadToEnd (Or any other type of Read), or a .WaitForExit, then the ASP.NET page will hang as well. I took the exact same code I'm using in the ASP.NET page, and put it into a standard windows VB.NET app. I ran that app on the server, and it worked with no problems at all. In addition, using the same code in the ASP.NET page with a different app works just fine, so I know that it has something to do with the program I'm trying to run, but can't figure out what exactly it is. If anyone is willing to help me with this, I will gladly send you the program (It's only a 300kb single-file executable), to see if you're able to help. And, here is the code that I'm using (VB):
Dim siStartInfo As New ProcessStartInf o("ls6remote.ex e") Dim pLSRemote As New Process Dim strReturn as String
'Initialize Process properties siStartInfo.Use ShellExecute = False siStartInfo.Cre ateNoWindow = True siStartInfo.Red irectStandardOu tput = True
pLSRemote = Process.Start(s iStartInfo) strReturn = pLSRemote.Stand ardOutput.ReadT oEnd Response.Write( strReturn) pLSRemote.Close ()
-- Message posted via http://www.dotnetmonster.com
I had checked and double-checked that the ASPNET account had full access to the file I was trying to run, but hadn't thought to try running as a different user. So, I followed your suggestion. Unfortunately, apparently process.start always runs as the account that ASP.NET is running as, regardless of the impersonation used. Even though System.Security .Principal.Wind owsIdentity.Get Current().Name showed what I was impersonating as, when I viewed the new process in Process Explorer, it showed it running as ASPNET. I tried lauching whoami.exe from an ASP.NET page, and it returned ASPNET. I Googled a little, and apparently this is the behavior of process.start, and that .NET 2.0 will have parameters for specifying a user to run as. That doesn't help me much currently, though.
Anyway, to test to be 100% sure if it was a permissions problem or not, I tried adding ASPNET to the administrators group, and it then worked. Then it was just a matter of using FileMon, and looking for any "ACCESS DENIED" results. Once I got that all sorted out, it's now working.
So, thanks for pointing me in the right direction.
--
Message posted via http://www.dotnetmonster.com
I'm glad I was able to help.
And thanks for sharing the additional details about how you got it working
so the rest of us can benefit.
--
Thanks,
Steve C. Orr, MCSD, MVP http://SteveOrr.net
"Jesse Cates via DotNetMonster.c om" <fo***@DotNetMo nster.com> wrote in
message news:b9******** *************** *******@DotNetM onster.com... I had checked and double-checked that the ASPNET account had full access to the file I was trying to run, but hadn't thought to try running as a different user. So, I followed your suggestion. Unfortunately, apparently process.star t always runs as the account that ASP.NET is running as, regardless of the impersonation used. Even though System.Securit y.Principal.Win dowsIdentity.Ge tCurrent().Name showed what I was impersonating as, when I viewed the new process in Process Explorer, it showed it running as ASPNET. I tried lauching whoami.exe from an ASP.NET page, and it returned ASPNET. I Googled a little, and apparently this is the behavior of process.start, and that .NET 2.0 will have parameters for specifying a user to run as. That doesn't help me much currently, though.
Anyway, to test to be 100% sure if it was a permissions problem or not, I tried adding ASPNET to the administrators group, and it then worked. Then it was just a matter of using FileMon, and looking for any "ACCESS DENIED" results. Once I got that all sorted out, it's now working.
So, thanks for pointing me in the right direction.
-- Message posted via http://www.dotnetmonster.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JC |
last post by:
I'm trying to create a GUI wrapper for dumpbin, and so I'm using the Process
class to run the command-line application. The problem is that if I use
Readline() to get the output from the commandline app, it will hang when it
comes to the command-prompt (there's no return to send it to readline).
Here's the code:
public bool RunCommands(string cmds, ArrayList files)
{
|
by: David Akerman |
last post by:
Hi,
Background
========
I've written a Web App in C# which controls a pool of Word Applications for
mailmerge purposes (not ideal using Word non-interactively I know, but I
have explored alternatives, and they all introduced various other problems,
leading me to discount them).
The main issue with this solution is that when there are problems with the
|
by: Scott |
last post by:
So I can't figure out how to Google for this problem, I'll
try asking for a solution here.
Whenever I deploy changes, whether they are changed
code-behind DLL's or ASPX/ASCX/ASAX pages to my staging and
production web servers the process hangs. I'm guessing it's
during the JIT compilation because if the process DOESN'T
hang, the problem never occurs after the first time you hit
the web application.
|
by: Sidharth |
last post by:
Hello,
We are experiencing some issues with the aspnet_wp process on our live
servers. The problems are intermittent and we cannot reproduce it on our dev
and test servers.
Currently around twice a day the aspnet_wp process takes 100% of the cpu and
causes the whole website to come to a stand still. We then have to end the
process for the website to become useable. Once the aspnet_wp process
recycled itself and in the event logs it...
|
by: Raymond Lewallen |
last post by:
How to wait for a process to stop completion is my goal. Obviously, the
looping while waiting for the HasExited property is not a solution.. but
thats the best I can come up off the top of my head. Natuarally it will not
work. I expect it to use up all resources looping, which will not allow the
process to complete. The process takes about 60 seconds, because the .bat
file it is calling is rebuilding mulitple .NET solutions and projects...
| |
by: Benzi Eilon |
last post by:
I have written a C# application which should run as a Windows
Service. I must avoid having multiple instances of the application
on one machine so I inserted the following code at the beginning
of the Main() function:
// if this is not the first instance of this application, exit
// immediately. Allow only one instance in the system
if
(Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length >
1)
|
by: jrm |
last post by:
..Net v1.1
I am trying to launch a MS Word merge document. It is linked to an Access mdb that has a parameterized query that pops up an input dialog when you open it. None of this should matter of course, but I think maybe it is causing the problem..?
I am doing this:
System.Diagnostics.Process merge_doc = new System.Diagnostics.Process();
merge_doc.StartInfo.FileName = "c:\adoc.doc";
merge_doc.Start();
The start call is blocking...
|
by: =?Utf-8?B?U3ZlbiBXLg==?= |
last post by:
Hi Newsgroup,
I am developing a C# Windows Forms application that launches processes within
a background worker..
The processes seem to have a memory limit of about 278mb. Some proccesses
that get to that
amount of used memory seem to hang ;-(
Is there a memory limit that can be adjusted ?? The physical machine has 3
|
by: Bali |
last post by:
Hi
I have an ASP.NET application. I am on the server side and trying to
start an application which is on the server. The process gets
started(can be seen in the Task Manager) but doesn't do anything(00
CPU cycles).
System.Diagnostics.Process.Start("c:\\Code\\testExe\\test.exe");
Now I have gone to the testExe folder and given both ASPNet and
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |