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 :)
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.
Related
I have an Asp.net application that handles the function of creating a directory and then viewing that directory (on the network).
Dim di As DirectoryInfo = New DirectoryInfo (Me.lblPath.Text)
di.Create()
Process.Start(Me.lblPath.Text)
Both creating and viewing the directory work perfectly from Visual Studio... but when I run the compiled asp.net application it shows me "access denied" in both cases.
[Win32Exception (0x80004005): Access denied]
The folder where the subdirectories are created is on the network and is shared for everyone.
Please help!
Actually, if you check, the folder probably was created. It really depends on the user you using to run the application pool.
However, then 2nd part?
Process.Start(Me.lblPath.Text)
That is not allowed anymore. Server running process (such as IIS) are in general not allowed to shell launch system apps.
So, you can get your code to create the folders. But, IIS is a service, and such running services as a general rule can't start (shell) execute things like windows explorer in this case.
You might try giving the application pool user rights to do this, but from what I can tell, by default, running IIS services, that service can't start such programs.
You can CERTAINLY do this on your development computer, since you running VS, and it runs + launches IIS express as a context as you the super user and owner of that computer.
but, on a real server, running IIS? Nope, in general this is not allowed. Quite sure this hole was plugged around 2008. In think in server 2012, you COULD set security to make this work (I believe some kind of rights to a console_0 user.
but, after 2012, even that option was removed.
So, such code? Yes, it will work during deployment on your development computer. but a server system, running IIS is locked down, and to my knowledge, you can't execute or run such processes.
Put in a try/catch, and send the error out to a extra text box on that page - you see the web does generate a error.
based on this question I was able to start xsp (web server from mono) as standalone webserver to serve some aspx sites.
It is said that xsp depends on some dlls that are stored for this purpose at the \bin directory. If someone try to run xsp without those dlls an error is thrown.
What I am trying to do is run this approach as service on windows in order to start it automatically without the need of log in to the computer. I know that services execute in a separate session, and when I try to execute xsp inside a service, I am having the same error as if I was trying to execute it without the dlls.
That gave me the idea that the service is not finding those dlls and, I may be wrong but, I think that if I could "register" those dlls inside the scope of the service, xsp (or any dll dependant .exe) could in fact execute without trouble inside a windows service.
The errors, both, the one inside the service execution and the one trying to run without dlls is as follows:
What I want to know is: is there a path where I can drop those dlls in order to the service to find them? is there a correct way to achieve this (I may be doing something wrong)?
If someone could help me it would be great.
I am having a problem with my application. The application works perfect on my development machine. It fails, without any errors on the live server. The page loads, but the code doesn't execute apparently.
I have been stuck on this for a while because I can't figure out how to get any information on the problem. There are no errors, so my custom errors settings in web.config are not helping.
I looked around online and I heard there was some remote debugging tool. The article was from .Net 1.0. I tried to follow it, but its not going to work because I am using a shared server. I do not have permissions to start the remote debugger on the server side.
I tried creating some output text files with variable contents, but the files are not being created either. They are created on my development machine, but never show up on the server, again with no error.
I have no idea how I'm supposed to figure out what is going on, because I'm not able to step through the code once it's on the live server.
Is there anyway to step through, or debug the code once I've published it? If I spent the extra money on a VPS, would that allow me to debug on the server side? I'm assuming I could just install Visual Studio on the VPS and step through the program. I've never used a VPS before.
Unless you do something very special in your code, it is unlikely that it behaves differently on your server compared to your workstation.
It is more likely that the configuration on the server is not correct.
You are saying your
code doesn't execute
How do you know that? You should first confirm that your code is actually executing.
you are also saying:
it is now directing me to a page that says "Directory Not Found"
a web server it never looking for directories, it is looking for resources, check your iis http logs what substatus codes are you getting?, enable Failed Request Tracing and review the logs.
Using Process Monitor can also help determine what the web server is doing.
Start with a very simple page and see whether that executes fine.
What I'm saying is, first debug/fix the execution environment before trying to debug your code.
You would never install Visual Studio on a server, the default installation of a Windows Server doesn't even allow you to install it. Instead you can use remote debugging components on the server and use your local Visual Studio to debug remotely.
Fitnesse download page only has option for standalone.jar and this is also what the instructions are for. Is it somehow possible to install FitNesse on a separate app server, such as Tomcat? There's not directly any war/ear to download, but can I bundle one somehow?
I'm experimenting with acceptance testing frameworks and need to run the tests on a very specific test environment, and thus require a possibility for installing on an already running app container where the tests are executed. Changes for getting even java executable from command line in this environment are slim, and if possible, the process would take probably months to realize.
I do not believe it is possible, but even if you were to get the wiki running inside an app server, a test run would still try to start a new java process (by starting the java executable) so you still need access to that executable.
But does the test environment really need to be in the app server? I usually use FitNesse to test an application from the outside: the test framework makes remote (http) calls to an application running in an app server, but it does not run in that same app server itself.
I wrote an asp.net web application, which launches a powershell script. The program ran without any issue when I debugged it in my development environment. After publishing and deploying the asp.net web application (by the way the target server is the same machine localhost), by clicking the button for launching the powershell script, nothing happened. It means the powershell script was not launched. I attached the debugger to the deployed asp.net and saw that the Shell.Invoke() was hit as before and the command was also correct. However Shell.Invoke() returned immediately and the powershell script was not launched. In my environment the powershell execution policy is RemoteSigned.
Since the program in the development environment works perfectly and in the deployed case also hits the same code, I don't think it has to do with the code but more with security, certification,...???
Has anyone experienced the same? If yes, please advise me what I should do.
I appreciate your help in advance.
Thx
Might have something to do with the application pool identity not having the right permissions:
You might want to run your PowerShell invocation from a system service with explicit permissions though. That will take a steeper curve though.