问题
I'm trying to write a web service on my server windows server2008 to invoke some applications on my server. I user system.diagnostics.process class to invoke exe files. It works fine on server itself, but when i use the webservice over a different pc, I got error message which is specified file not found. But when I just launch cmd.exe it works fine too. As far as i understand I have access to server which i can run at least cmd.exe on. But when it comes to invoke different exe's it just doesn't work. I have another clue too, when I run the cmd.exe remotely it runs, and I try to kill it remotely then it gives me the error "Access denied".
I'm not familiar with this kind of server access,permission jobs. Hence I need some help. Any help would be appreciated :)
回答1:
You need to make sure that the Application Pool in IIS in running as a user that has permission to execute the executables on that server.
Just a word of warning (as you may know): this is a huge security risk if you expose these services out to anywhere. Opening up a service to run an application can be risky so I would make sure that there's no other way to do what you're trying to accomplish.
来源:https://stackoverflow.com/questions/11358947/invoke-an-application-using-webservice