run exe from aspx on server 2003

Asked By Andy Kalbvleesch
06-Feb-08 03:54 PM
Earn up to 0 extra points for answering this tough question.

I previously started a thread on a problem I have. I need to run a program called zoomifyer that converts an image somebody can upload. In order I tried everything like proces start, runcommand, etc. I'll post some code below. I think it is a server setting but tried everythin there as well and given all rights to user, add exe as extension, etc. I went on to try different things. So now I have remote acces to my server. When going to the cmd line I do: c:\domains\tumswear.com\wwwroot\zoomifyer.exe and the process starts fine. I can see in taskmanager: username fresh-jjejeje.

When I try to run the code below I also see the proces in taskmanager but with username NETWORK. Makes sense but the problem is that when I run from commandline the program actually starts and really opens, when I run fromaspx page it only shows in taskmanager, doesn't show and never closes therefor. Everytime I run the page, new process starts but it never really starts... Offcourse the thought would be that the Arguments would be the file I want to convert.  I have been on this for days and it is driving me insane... especially since I strongly believe it has to do with installation of service pack 2 last week... for server 2003 (before I think it worked fine...)

Dim info As New ProcessStartInfo
        info.FileName = "c:\domains\tumswear.com\wwwroot\zoomifyer.exe"
        info.RedirectStandardInput = False
        info.RedirectStandardOutput = True
        info.Arguments = ""
        info.UseShellExecute = False
        Dim p As New Process
        p.StartInfo.UserName = "fresh-mstsc"
        p.StartInfo.Password = ConvertToSecureString("fresh-mstsc")
        p.StartInfo.Domain = "doesnt matter I think"
        p.StartInfo = info
        p.Start()
        p.WaitForExit(90)

 

 

 

 

 

 

  See the following link. I had the same problem and solved like this

alice wonder replied to Andy Kalbvleesch
06-Feb-08 04:18 PM

  That's all fine and simple.. but

Nenad Prekupec replied to alice wonder
06-Feb-08 04:59 PM
Doing such things you create security hole in your web applications...
I really can't understand why would you execute process in the first place especially where there is native .NET way of doing things, and elegant imo.

ASPNET account is with reason weak account and tempering with rights of that account can lead you on the wrong track.

  invoking exe

sundar k replied to Andy Kalbvleesch
07-Feb-08 12:00 AM

If you want to display the output of the exe which you have invoked from your asp.net application, you can probably take a look at the below code as well! hope it helps!

<%@ Page Language="vb" %>
<%@ Import Namespace="System.Diagnostics" %>
<%
      ''Get a file name relative to the current Web app.
      Dim file As String = Server.MapPath("Program.exe")
      Dim info As ProcessStartInfo = new ProcessStartInfo(file, "/arguments")
      ''Redirect output so we can read it.
      info.RedirectStandardOutput = true
      ''To redirect, we must not use shell execute.
      info.UseShellExecute = false
      ''Create and execute the process.
      Dim p As Process = Process.Start(info) p.Start()
      ''Send whatever was returned through the output to the client.
      Response.Write(Replace(p.StandardOutput.ReadToEnd(), vbCrLf, "<BR />"))
%>

 

  Thanx all but no thanx
Andy Kalbvleesch replied to Nenad Prekupec
07-Feb-08 05:28 AM

Sometimes I wonder why people just respond for the hell of it... Is it really because you want to help or try to outsmart another person. As for Nenad, Zoomifyer is an exe that you run in order to feed a flash component. The exe creates 30 or so tiles from one image. There would be no way in creating these tiles in an elegant asp.net way since they are tiles from different coordinates you could never figure out which slices/tiles you have to make.... As for Sundar, you gave me allmost the exact code I posted my self so what is the use of that ?

Alice on the other hand was really more helpfull, allthought I still haven''t solved the problem. I'll post that in a different post.

  should work but doesn't
Andy Kalbvleesch replied to alice wonder
07-Feb-08 05:32 AM

Hi Alice,

It makes sense what they say in the article. However I have checked and the Allow Service to Interact with Desktop check box is checked. I have administrator rights and when running the exe from my aspx it shows up in taksmanager with username Administrator but still no showing at my desktop and stays in memory....

Help ?

  It's not my intention to outsmart anyone...
Nenad Prekupec replied to Andy Kalbvleesch
07-Feb-08 07:39 AM
I'm just trying to point out problems you might have giving ASPNET user too much privileges.
And yes you can tile images on the .NET way, on as much tiles you really want. And yes there is more work to be done and yes there are good examples you can use to do what you want.
The other thing I wanted to point out is that each page request will execute "zoomify.exe" process and potentially a lot of requests to that page will kill your server, do you want to do this really?
I'm sorry if you found  my tone somehow offending but it wasn't my intention, was just trying to help.
  Hmmm
Robbe Morris replied to Andy Kalbvleesch
07-Feb-08 05:28 PM

It is entirely possible that zoomifyer is trying to write to some sort of temporary folder that ASP.NET does not have access to and the StartInfo properties are not handling the identity authentication properly.  If that were the case, I could see the app launching a messagebox showing the error which of course you couldn't see in the web page.  Zoomifyer may have also written an event to the windows event log.

You could try setting the web site itself in IIS to run under a specific account to test this out.

On a side note, zoomyfier may not be suitable for use in a web environment.  For instance, Microsoft Excel as part of Microsoft Office is not suitable in a web environment.  It is easy to have those processes get locked up and hang. Do your IIS settings permit launching of exe's?

Hence, all of these controls that interact with Excel files in ASP.NET.

When you contacted the company about support in ASP.NET, what did they say?

  Update
Manoj kalra replied to sundar k
21-Oct-08 08:17 AM
I am having the same issue with Zoomify exe

did any one resolve this issue?
  re: Update
Goran Glavaš replied to Manoj kalra
13-Apr-10 12:08 PM
Same troubles with zoomify exe here. I repeat the question... Did anyone find a work around for this one?
Create New Account