473,569 Members | 2,698 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="C hanges Password calls
Change_Password .vbs",EnableSes sion = true)]

public string ChngPwd()

{

try {

Process proc = new Process();

proc.EnableRais ingEvents=true;

proc.StartInfo. FileName="wscri pt.exe";

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

proc.Start();

proc.WaitForExi t();

proc.Dispose();

return "ran change password";

}

catch (Win32Exception e)

{
return e.Message ;

}
}

}
Nov 21 '05 #1
3 14071
Check the doc on the Process class. You may need one or more of the
following:
proc.StartInfo. WindowStyle =
System.Diagnost ics.ProcessWind owStyle.Hidden;
proc.StartInfo. RedirectStandar dOutput = true;
proc.StartInfo. UseShellExecute = false;
-D
"stephen" <sw***@aol.co m> wrote in message
news:DMM6d.2712 $pN6.2457@fed1r ead06...
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="C hanges Password calls
Change_Password .vbs",EnableSes sion = true)]

public string ChngPwd()

{

try {

Process proc = new Process();

proc.EnableRais ingEvents=true;

proc.StartInfo. FileName="wscri pt.exe";

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

proc.Start();

proc.WaitForExi t();

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.Diagnost ics.ProcessWind owStyle.Hidden;
proc.StartInfo. RedirectStandar dOutput = true;
proc.StartInfo. UseShellExecute = false;


-D


"stephen" <sward@aol.co m> wrote in message
news:DMM6d.2712 $pN6.2457@fed1r ead06...[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="C hanges Password calls
> Change_Password .vbs",EnableSes sion = true)]
>
> public string ChngPwd()
>
> {
>
> try {
>
> Process proc = new Process();
>
> proc.EnableRais ingEvents=true;
>
> proc.StartInfo. FileName="wscri pt.exe";
>
> proc.StartInfo. Arguments="c:\\ myScript.vbs";
>
> proc.Start();
>
> proc.WaitForExi t();
>
> 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
6833
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 process. That's strange for me. I understand that it should be a new shell, but why I can't start it? Is it need to have a Windows application to...
4
15518
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# application. The command runs successfully from a Windows Form but fails if the application is recasted as a Windows service. The application is...
0
1108
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 event doesn't fire while I'm already in it. At the end of the timer elapsed event I re-enable it. However, while running in the debugger, the event...
23
7561
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 unrecoverable error occurs. When that case occurs, I create a ServiceController object and call the Stop() method. However - I get an exception...
1
5787
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 to call the batch file, it just returns with a return code of 1. When I call cmd.exe, and pass the batch file as a parameter it hangs. After much...
5
2864
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 (other than the service being stopped) it would restart it. I have written the service to do just this, and for testing purposes I am running the...
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 New System.Diagnostics.Process 'p.Start(MDEPDirStr & "macrun.exe", sPPTOut) p.Start("C:\WINDOWS\SYSTEM32\CALC.EXE")...
8
55672
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 everything I've tried, I cannot get MySQL to start as a Windows service. However, I AM able to get it started via the mysqld-nt --console command. Here...
1
2209
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 start several instances of the same application, like multiple Windows Calculators for instance. We are experiencing difficulties starting...
0
7698
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, 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...
0
8122
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7673
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5513
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
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...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
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 we have to send another system
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.