Execute exe outside of IIS7 called from HTML

Posted on 2010-08-19
Medium Priority
Last Modified: 2013-12-25
I've written a small executable which I want to call another exe that is outside the wwwroot folder in IIS7.  I first type in the URL http://localhost/test.exe, then the test.exe will call Process.Start(@"C:\test2.exe").  

Now the problem is that test.exe does not have permission to execute because the user (the one who calls test.exe) does not have enough permissions.  Of course I tried to fixed this but it didn't work.  

I've tried many solutions and none have worked, here they are.
1. Changed Process.StartInfo.WorkingDirectory to "C:\"
2. Impersonated Local User (had to use direct windows calls, this did not throw an exception but the test2.exe did not execute)
3. Added/Changed permissions (IUSER,Local Service,Local Users, Network Service, Everyone)
4. Changed Process.Startinfo.UseShellExecute =false

Heres the exception thrown:
Unhandled Exception: System.ComponentModel.Win32Exception: Access is denied
   at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at ProcessStart.Program.Main(String[] args)
Question by:htn5ca
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 33478446
When I did this I used the scheduled tasks to drive the calling (you can leave that configured with a user who has higher permissions).


Author Comment

ID: 33478643
Sorry ged325 but I am looking for a more instantaneous answer because it is a time sensitive event.

The other exe just opens a socket (which iis7 won't allow me to do) and sends a command to a server.
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 33484461
Is the EXE home grown or 3rd party?  There are ways to do it from within the application.  What is the purpose in limiting the range of ports used for outbound connections?  (Not questioning the validity of your need, but if you explain why there may be other ways around this.)
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

LVL 40

Expert Comment

by:Kyle Abrahams
ID: 33484556
^^ should never do EE before my first cup of coffee.

You can issue a command from there to run a scheduled task the next second.  Do you need it to run sooner than that?

What if you moved the EXE into the folder to give users permission to run it (grant execute on the directory).

Author Comment

ID: 33513790
Well the whole purpose of calling another EXE outside of the IIS7 folder is because I do not have permission to create a socket connection to a server.  I've granted execute permission to the EXE, full control to IUSR (user that calls the exe) and even added all users with full permissions with no luck at all.  
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 33514558
how sensitive is the timing?  

From my understanding you're trying to make an outbound connection from the server back to the client because you can't use the client to go back to the server?  More details of what you want to have happen (ideally) would be helpful.


Author Comment

ID: 33526803
Heres the scenario:

Some software would query my IIS server with something like ""

My test.exe (hopefully) create a socket connection with and send some set of commands that is hard coded.  

LVL 40

Accepted Solution

Kyle Abrahams earned 2000 total points
ID: 33530917
I would go back to my original suggestion of using a scheduled task to kick off the process.  You can schedule to execute 1 second after you get the request.

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question