Solved

Execute exe outside of IIS7 called from HTML

Posted on 2010-08-19
8
951 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 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).

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 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.)
0
Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

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

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 40

Accepted Solution

by:
Kyle Abrahams earned 500 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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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 strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

691 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