473,503 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c# web service trying to call an external using process.Start(

when I try consuming this method the method just hangs, if I look at the
processes I can see that the wscript is running but it just seems to hang.

shouldn't this be fairly trivial calling an external from within a
webservice ?

[WebMethod (Description="Changes Password calls
Change_Password.vbs",EnableSession = true)]

public string ChngPwd()

{

try {

Process proc = new Process();

proc.EnableRaisingEvents=true;

proc.StartInfo.FileName="wscript.exe";

proc.StartInfo.Arguments="c:\\myScript.vbs";

proc.Start();

proc.WaitForExit();

proc.Dispose();

return "ran change password";

}

catch (Win32Exception e)

{
return e.Message ;

}
}

}
Nov 21 '05 #1
3 14056
Check the doc on the Process class. You may need one or more of the
following:
proc.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
-D
"stephen" <sw***@aol.com> wrote in message
news:DMM6d.2712$pN6.2457@fed1read06...
when I try consuming this method the method just hangs, if I look at the
processes I can see that the wscript is running but it just seems to
hang.

shouldn't this be fairly trivial calling an external from within a
webservice ?

[WebMethod (Description="Changes Password calls
Change_Password.vbs",EnableSession = true)]

public string ChngPwd()

{

try {

Process proc = new Process();

proc.EnableRaisingEvents=true;

proc.StartInfo.FileName="wscript.exe";

proc.StartInfo.Arguments="c:\\myScript.vbs";

proc.Start();

proc.WaitForExit();

proc.Dispose();

return "ran change password";

}

catch (Win32Exception e)

{
return e.Message ;

}
}

}

Nov 21 '05 #2
loydvidal
1 New Member
Hi, I am having the same problem and it does not work...
It hangs and does nothing...
Anyone to help?

Check the doc on the Process class. You may need one or more of the
following:
proc.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;


-D


"stephen" <sward@aol.com> wrote in message
news:DMM6d.2712$pN6.2457@fed1read06...[color=blue]
> when I try consuming this method the method just hangs, if I look at the
> processes I can see that the wscript is running but it just seems to
> hang.
>
> shouldn't this be fairly trivial calling an external from within a
> webservice ?
>
>
>
> [WebMethod (Description="Changes Password calls
> Change_Password.vbs",EnableSession = true)]
>
> public string ChngPwd()
>
> {
>
> try {
>
> Process proc = new Process();
>
> proc.EnableRaisingEvents=true;
>
> proc.StartInfo.FileName="wscript.exe";
>
> proc.StartInfo.Arguments="c:\\myScript.vbs";
>
> proc.Start();
>
> proc.WaitForExit();
>
> proc.Dispose();
>
> return "ran change password";
>
> }
>
> catch (Win32Exception e)
>
> {
>
>
> return e.Message ;
>
> }
>
>
> }
>
> }
>
>[/color]
Feb 14 '06 #3
AbelMorelos
1 New Member
I had the same problem, and my problem was solved by adding:

UseShellExecute = false;

Anyway, please check if you really don't need the shell for the desired processes... in my case I was just launching exe files, so I didn't required any shell service.

Regards.
Jul 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6827
by: Dmitri Shvetsov | last post by:
Hi, Can I start an external process from the Web Service? I'm using a code, compiler keeps silence, compiles ok and starts the project. When I trace in Debugger it doesn't start an external...
4
15503
by: Primo | last post by:
Hi, This problem has been frustrating me for days and I hope you experts can help me out. I am trying to run a command, which I would normally run from the command line, from within my C#...
0
1104
by: Microsoft | last post by:
I'm creating a service and am using a timer in it. When the service starts I enable the timer, and then in the timer elasped event, I'm disabling it (this.srvcTimer.Enabled = false) so the timer...
23
7538
by: Adam Clauss | last post by:
I have a C# Windows Service running as the NetworkService account because it needs to access a network share. As part of the service's initialization, I want the service to terminate, if an...
1
5785
by: Bucky Pollard | last post by:
I have a web service that needs to create a batch file and call it (since there are no APIs for the functionality I am looking for). I am using the Process and ProcessStartInfo objects. When I try...
5
2863
by: Andrew | last post by:
Hey all, Requesting help from the VB.Net gurus in here. I was given a task to write a Windows Service (VB.Net) that would run an external program, and if that program closed for any reason...
5
3612
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
8
55664
by: Kevin D. | last post by:
Please note, I already posted this on the MySQL official forum, but received no response. I thought I'd try again in another location. My apologies to anyone reading this twice... Despite...
1
2201
by: mikelujan | last post by:
Hi, Our application starts an external application using System.Diagnostics.Process class and the Start() method, as per code snippet below. This application run as a Windows service, and must...
0
7204
marktang
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,...
0
7091
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...
0
7342
jinu1996
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...
1
6998
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7464
tracyyun
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...
1
5018
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1516
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
391
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.