views:

90

answers:

2

I am developing a remote control application where a client (aspx page in a browser) can request a server to "launch a notepad" (for testing purpose, for real life, turning off a light bulb, etc). So I created a dll with a simple function for launching the notepad (on the server side) and dropped this dll in the root bin folder.

It worked fine when the aspx page is running under ASP.NET development server (launched from Visual Studio). But when I tested the same aspx page under a FireFox browser, it did not work (launch the notepad) even though it did call for the same function (I stepped through in debugger).

Is this a permission issue? How do I set this up in IIS manager, or even better in web.config?

Please help.

+2  A: 

Yes, it sounds like a permission issue.

The application pool in IIS 7 that your site is running under is probably using the default identity, which is the most restrictive. You can change the identity in IIS Manager by right-clicking on the app pool (probably called DefaultAppPool) and selecting Advanced Settings. From there change the Identity value to Local Service or Network Service. If neither of those work, making it Local System should allow your page to work.

I assume the Visual Studio integrated web server runs under the context of the account you are logged in with on the machine, which likely has a lot more rights.

Chris Tybur
Thanks Chris. Your suggestion gave me a good direction. I did what you suggested by setting the defaultAppPool to LocalSystem Identity and verified the web site was indeed running under defaultAppPool. However, it is still not launching Notepad. Is there anything I should do to grand ASP.NET right since I am trying to run a dll that should be handled by ASP.NET?
Wayne Lo
What would be good to do next is try to determine if it's still a permission issue or your testing methodology. I assume you try to launch Notepad because it's a visible indication that your 'light switch' code works. I would replace the code that launches Notepad with something else that can show it works, but doesn't interact with the desktop or try to launch programs with a visible UI.Maybe you can try writing to one of the Windows event logs, or writing to a text file in the root of the site. If you can successfully do one of those two things, then permissions are no longer an issue.
Chris Tybur
A: 

When you say:

it did not work (launch the notepad)

Did you mean it through an exception or you didn't see a notepad window open. If it was a permissions issue I would expect you that you would get an exception. Chris is right on when he says:

The application pool in IIS 7 that your site is running under is probably using the default identity, which is the most restrictive.

and

I assume the Visual Studio integrated web server runs under the context of the account you are logged in with on the machine, which likely has a lot more rights.

and if this is a permissions issue he is right on. However, the user your running under (when not debugging in Visual Studio) most likely cannot access the desktop of the logged in user. Maybe you should try your test with an app that doesn't need to interact with the desktop.

drs9222
Thank you for responding. The code did execute without error but the notepad was not launched. The goal of this code is to have the server computer runs a dll requested from a client. I goal is to turn on and off a hardware device like a light switch.
Wayne Lo