tags:

views:

148

answers:

2

Hi all

I'm trying to call a windows Console application in my Web Service. If I'm running it as a local service i.e in the same solution it works perfectly but if i try to call it through my Web Service hosted as IIS localServer it doesn't call it. i think it's security problem. I'm new to web service and I'm calling the application using

           Process.Start() funtion...

And one more thing if it's Windows Service it works great....

Any Idea???

A: 

does the IUSR_* user account have permission to execute the console application?

Stobor
A: 

Hi, treat your console as a separate project. Make sure that works first.

I've done what you've described in an asp.net web app. I've tested it; the same code works fine in a web service. The trick here is the "startInfo.UseShellExecute = False"

In the example, parameters are being passed to the console app which is executed at runtime. (sorry its in VB).

Dim startInfo As System.Diagnostics.ProcessStartInfo Dim pStart As New System.Diagnostics.Process

startInfo = New System.Diagnostics.ProcessStartInfo("C:\Inetpub\wwwroot\KPIMi\Annotation Editor\Annotation_Console.exe") startInfo.Arguments = strServerName & "-" & strPrimaryKey & "-" & txtStart.Text startInfo.UseShellExecute = False

pStart.StartInfo = startInfo pStart.Start()

pStart.WaitForExit() 'Your code will halt until the exe file has executed.

Hope this helps.

MoSlo
One more thing, be sure to grant the PC-NAME\ASPNET local account has access to the exe's location.
MoSlo