Question web service to run exe

napii21

Member
Joined
Oct 27, 2011
Messages
18
Programming Experience
3-5
Hi guys,

i have a function to run an exe. If i put the function windows application, it can run the exe. but if i put the function in web service and call the web service from windows application, it cannot run the exe.

this is the function that i put in web service:

VB.NET:
            Dim info As New ProcessStartInfo()
            Dim preader As StreamReader
            Dim htmltoolsPath
            Dim xmlDoc As New XmlDocument


            htmltoolsPath = ConfigurationManager.AppSettings("htmlToolsPath")
            ' info.FileName = "C:\htmltools\htmltools.exe"
            info.FileName = htmltoolsPath
            info.Arguments = inFile & " " & outFile
            info.UseShellExecute = False
            info.RedirectStandardOutput = True


            Dim returnvalue As Process
            Dim exeStatus As Boolean


            returnvalue = Process.Start(info)


            exeStatus = returnvalue.Start()


            If exeStatus Then
                preader = returnvalue.StandardOutput
                preader.ReadToEnd()
            End If

it did not throw any exception. just didn't run the exe.

any idea why this happened?
 
How exactly are you determining that it's not running the program? By the way, why are you calling Process.Start twice?

The program is a command prompt. So, i will know the program is running when it show up on the screen. Other than that, the program is supposed to convert html to pdf. So, when i called the function from windows application, it worked fine. But when i called the function from web service,it didn't.

The second process.start will get the status of pdf conversion. It doesn't matter.

I just want to know if web service can run exe. If it does, what is wrong with my code. I hope someone can help me.
 
The web service is not running under the same session as your interactive user, so it's not going to show anything on the desktop of that interactive user. Have you had a look at Task Manager and shown processes for all users? If the process runs then it will show up there.
 
you are right,jmcilhinney. i have looked at task manager and it shows that the program was actually running. i will keep debugging the code to find why the program didn't convert the html to pdf.
Thanks a lot.
 
Back
Top