Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Execute exe outside of IIS7 called from HTML

Posted on 2010-08-19
8
Medium Priority
?
962 Views
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)
0
Comment
Question by:htn5ca
[X]
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
8 Comments
 
LVL 41

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).

http://stackoverflow.com/questions/542804/asp-netbest-way-to-run-scheduled-tasks
0
 

Author Comment

by:htn5ca
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.
0
 
LVL 41

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.)
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 41

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).
0
 

Author Comment

by:htn5ca
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.  
0
 
LVL 41

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.

0
 

Author Comment

by:htn5ca
ID: 33526803
Heres the scenario:

Some software would query my IIS server with something like "http://192.168.1.2/test.exe?Action=Start&IP=132.52.234.5"

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

0
 
LVL 41

Accepted Solution

by:
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.
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

618 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