Process.Start woes in ASP.Net application

G

Guest

I am at my witless end here, please help!

I have an ASP.Net aspx web page, hosted on Windows Server 2003, that
receives a query string with the path to an autocad drawing file selected
from a web page hosted on a unix driven file server. The user wants to have
this file converted to a pdf.

My page takes the query string and turns it into a windows unc path, then I
copy the file down to the web server and place it into a directory. This all
works fine.

The next step is to call an application that will convert the file into a
pdf, here is where the woes begin...

I have a 3rd party windows command line tool, installed on the same server
that my web app resides on, and it takes two parameters: fileIn and fileOut.

I am using Process.Start and ProcessStartInfo to call the conversion app
but it appears that the arguments are not getting through to it. I can see
the process running in Task Manager, but it hangs.

When I query the process through either Process.GetProcessById or
Process.GetProcessesByName, none of the ProcessStartInfo properties that I
have set have retained their value.

When I attempt to read the StandardOutput, I get an 'invalid character' error.

I have my web config set to <identity impersonate="true"/>, and have set the
IIS Directory Security anonymous user to the computer admin, for testing of
permissions.

Here is the code:

Dim procStringArgs As String = " /InFile " & Path & DrawingIn & " /OutFile "
& PDFOut & " /Hide"
'call conversion application with proc args
Dim proc As New Process
Dim procSI As New ProcessStartInfo
procSI.FileName = CONVERTER_FULLPATH
procSI.Arguments = procStringArgs
procSI.UseShellExecute = False
procSI.RedirectStandardOutput = True
procSI.RedirectStandardError = True
proc.StartInfo = procSI
proc.Start()


When I print out the FileName and Arguments to a log file this is the result:

FileName: C:\Program Files\[app dir]\[app].exe
proc args: /InFile c:\inetpub\wwwroot\[webapp]\InBox\[drawing].DWG /OutFile
c:\inetpub\wwwroot\[webapp]\OutBox\[drawing].pdf /Hide

The process runs under the Network Service username, which I have given full
access to the above directories, thinking it was a permissions issue.

Any suggestions greatly appreciated and eagerly implemented for testing,
thank you.
 
G

Guest

I would like to follow up with some more information that may be helpful to
those trying to help me.

Pasting the app name and arguments from my log file into a command window or
the run command works fine.

Also, I took my code from the web app and put it into a windows form, and it
worked fine.

This makes me think that there is an issue with communicating from an
ASP.Net web app hosted in IIS to an executable file on the server, and
passing arguments to the executable.


--
Coding in Sunny Central Florida


VB Jonnie said:
I am at my witless end here, please help!

I have an ASP.Net aspx web page, hosted on Windows Server 2003, that
receives a query string with the path to an autocad drawing file selected
from a web page hosted on a unix driven file server. The user wants to have
this file converted to a pdf.

My page takes the query string and turns it into a windows unc path, then I
copy the file down to the web server and place it into a directory. This all
works fine.

The next step is to call an application that will convert the file into a
pdf, here is where the woes begin...

I have a 3rd party windows command line tool, installed on the same server
that my web app resides on, and it takes two parameters: fileIn and fileOut.

I am using Process.Start and ProcessStartInfo to call the conversion app
but it appears that the arguments are not getting through to it. I can see
the process running in Task Manager, but it hangs.

When I query the process through either Process.GetProcessById or
Process.GetProcessesByName, none of the ProcessStartInfo properties that I
have set have retained their value.

When I attempt to read the StandardOutput, I get an 'invalid character' error.

I have my web config set to <identity impersonate="true"/>, and have set the
IIS Directory Security anonymous user to the computer admin, for testing of
permissions.

Here is the code:

Dim procStringArgs As String = " /InFile " & Path & DrawingIn & " /OutFile "
& PDFOut & " /Hide"
'call conversion application with proc args
Dim proc As New Process
Dim procSI As New ProcessStartInfo
procSI.FileName = CONVERTER_FULLPATH
procSI.Arguments = procStringArgs
procSI.UseShellExecute = False
procSI.RedirectStandardOutput = True
procSI.RedirectStandardError = True
proc.StartInfo = procSI
proc.Start()


When I print out the FileName and Arguments to a log file this is the result:

FileName: C:\Program Files\[app dir]\[app].exe
proc args: /InFile c:\inetpub\wwwroot\[webapp]\InBox\[drawing].DWG /OutFile
c:\inetpub\wwwroot\[webapp]\OutBox\[drawing].pdf /Hide

The process runs under the Network Service username, which I have given full
access to the above directories, thinking it was a permissions issue.

Any suggestions greatly appreciated and eagerly implemented for testing,
thank you.
 
N

Newbie Coder

Jonnie,

A few things I would like to know:

1) Does the application have full trust in the GAC?
2) Have you tried http://localhost... instead?
3) What permissions do you have on the server for this to run?
4) Your path (path & file...) Path.Combine(path, file)... & is the a space
after the filename & before the out switch?
5) Is IIS 6 & directory have execute permissions?

These are the types of things worth checking.

Please post back your findings,

--
Newbie Coder
(It's just a name)


VB Jonnie said:
I would like to follow up with some more information that may be helpful to
those trying to help me.

Pasting the app name and arguments from my log file into a command window or
the run command works fine.

Also, I took my code from the web app and put it into a windows form, and it
worked fine.

This makes me think that there is an issue with communicating from an
ASP.Net web app hosted in IIS to an executable file on the server, and
passing arguments to the executable.


--
Coding in Sunny Central Florida


VB Jonnie said:
I am at my witless end here, please help!

I have an ASP.Net aspx web page, hosted on Windows Server 2003, that
receives a query string with the path to an autocad drawing file selected
from a web page hosted on a unix driven file server. The user wants to have
this file converted to a pdf.

My page takes the query string and turns it into a windows unc path, then I
copy the file down to the web server and place it into a directory. This all
works fine.

The next step is to call an application that will convert the file into a
pdf, here is where the woes begin...

I have a 3rd party windows command line tool, installed on the same server
that my web app resides on, and it takes two parameters: fileIn and file Out.

I am using Process.Start and ProcessStartInfo to call the conversion app
but it appears that the arguments are not getting through to it. I can see
the process running in Task Manager, but it hangs.

When I query the process through either Process.GetProcessById or
Process.GetProcessesByName, none of the ProcessStartInfo properties that I
have set have retained their value.

When I attempt to read the StandardOutput, I get an 'invalid character' error.

I have my web config set to <identity impersonate="true"/>, and have set the
IIS Directory Security anonymous user to the computer admin, for testing of
permissions.

Here is the code:

Dim procStringArgs As String = " /InFile " & Path & DrawingIn & " /OutFile "
& PDFOut & " /Hide"
'call conversion application with proc args
Dim proc As New Process
Dim procSI As New ProcessStartInfo
procSI.FileName = CONVERTER_FULLPATH
procSI.Arguments = procStringArgs
procSI.UseShellExecute = False
procSI.RedirectStandardOutput = True
procSI.RedirectStandardError = True
proc.StartInfo = procSI
proc.Start()


When I print out the FileName and Arguments to a log file this is the result:

FileName: C:\Program Files\[app dir]\[app].exe
proc args: /InFile c:\inetpub\wwwroot\[webapp]\InBox\[drawing].DWG /OutFile
c:\inetpub\wwwroot\[webapp]\OutBox\[drawing].pdf /Hide

The process runs under the Network Service username, which I have given full
access to the above directories, thinking it was a permissions issue.

Any suggestions greatly appreciated and eagerly implemented for testing,
thank you.
 
G

Guest

Thank you so much for the response, I will try to answer your questions as
best I can...

1) Does the application have full trust in the GAC?
A) I tried to drag and drop the executable into the Windows\assembly folder,
but it said that the executable was expected to have a manifest.
2) Have you tried http://localhost... instead?
A) Not yet, I will try that today.
3) What permissions do you have on the server for this to run?
A) This is being run through IIS with integrated windows authentication
turned on and an administrator as the anonymous access user. I test from my
machine and remote into the server as administrator to keep work on IIS and
read my log files.
4) Your path (path & file...) Path.Combine(path, file)... & is the a space
after the filename & before the out switch?
A) Yes, I am pretty sure... I have tweaked the dickens out of that string
trying to get the call to work, and it looks right now ( "app_path" "
/switches..." )
5) Is IIS 6 & directory have execute permissions?
A) Interesting point. Short answer is yes. Long story is that I was not able
to publish to the server until FrontPage server extensions were installed.
Now when I publish I have to change the 'Scripts and Executables' Execute
permissions to Scripts only and then 'Convert the Server Extensions 2002 Web
to Driectory'. If I do not I get a publish error that states that I cannot
place files in a directory marked as executable, or that it cannot find the
directory. So I change them back and forth between testing and publishing -
ugh.

Thank you for your interest in helping with this, I really appreciate it.

--
Coding in Sunny Central Florida


Newbie Coder said:
Jonnie,

A few things I would like to know:

1) Does the application have full trust in the GAC?
2) Have you tried http://localhost... instead?
3) What permissions do you have on the server for this to run?
4) Your path (path & file...) Path.Combine(path, file)... & is the a space
after the filename & before the out switch?
5) Is IIS 6 & directory have execute permissions?

These are the types of things worth checking.

Please post back your findings,

--
Newbie Coder
(It's just a name)


VB Jonnie said:
I would like to follow up with some more information that may be helpful to
those trying to help me.

Pasting the app name and arguments from my log file into a command window or
the run command works fine.

Also, I took my code from the web app and put it into a windows form, and it
worked fine.

This makes me think that there is an issue with communicating from an
ASP.Net web app hosted in IIS to an executable file on the server, and
passing arguments to the executable.


--
Coding in Sunny Central Florida


VB Jonnie said:
I am at my witless end here, please help!

I have an ASP.Net aspx web page, hosted on Windows Server 2003, that
receives a query string with the path to an autocad drawing file selected
from a web page hosted on a unix driven file server. The user wants to have
this file converted to a pdf.

My page takes the query string and turns it into a windows unc path, then I
copy the file down to the web server and place it into a directory. This all
works fine.

The next step is to call an application that will convert the file into a
pdf, here is where the woes begin...

I have a 3rd party windows command line tool, installed on the same server
that my web app resides on, and it takes two parameters: fileIn and file Out.

I am using Process.Start and ProcessStartInfo to call the conversion app
but it appears that the arguments are not getting through to it. I can see
the process running in Task Manager, but it hangs.

When I query the process through either Process.GetProcessById or
Process.GetProcessesByName, none of the ProcessStartInfo properties that I
have set have retained their value.

When I attempt to read the StandardOutput, I get an 'invalid character' error.

I have my web config set to <identity impersonate="true"/>, and have set the
IIS Directory Security anonymous user to the computer admin, for testing of
permissions.

Here is the code:

Dim procStringArgs As String = " /InFile " & Path & DrawingIn & " /OutFile "
& PDFOut & " /Hide"
'call conversion application with proc args
Dim proc As New Process
Dim procSI As New ProcessStartInfo
procSI.FileName = CONVERTER_FULLPATH
procSI.Arguments = procStringArgs
procSI.UseShellExecute = False
procSI.RedirectStandardOutput = True
procSI.RedirectStandardError = True
proc.StartInfo = procSI
proc.Start()


When I print out the FileName and Arguments to a log file this is the result:

FileName: C:\Program Files\[app dir]\[app].exe
proc args: /InFile c:\inetpub\wwwroot\[webapp]\InBox\[drawing].DWG /OutFile
c:\inetpub\wwwroot\[webapp]\OutBox\[drawing].pdf /Hide

The process runs under the Network Service username, which I have given full
access to the above directories, thinking it was a permissions issue.

Any suggestions greatly appreciated and eagerly implemented for testing,
thank you.
 
G

Guest

I checked the event logs and found the following error directed from the 3rd
party conversion app that I am calling:

Event Type: Information
Event Source: Application Popup
Event Category: None
Event ID: 26
Description:
Application popup: conversionapp.exe - Application Error : The application
failed to initialize properly (0xc0000142). Click on OK to terminate the
application.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top