I'm trying to run an exe with parameters from a web application.
I'm using Process.start() but it does not seem to run on iis!
It works fine when running from iis express. I'm publishing the application to my local iis as a test but it does nothing.
I've tried setting the iis admin service to enable interactions with the desktop and ive told iis to connect as my user credentials and set the application pool to use the same user credentials but still nothing works!
is there anything else someone can advise to get this working!
Cheers.
UPDATE
I got iis to run the process by setting the application pool identity to local system and double checking the credentials for the site.
But as expected the applications do not interact with the desktop, so creating a file from command line is simple, but running an application with parameters do not have the application open.
At the moment iis admin service has interact with desktop checked and is using the local system account.
Ok so this isn't really an answer but in the end I got process.start to work by setting the application pool identity to local system.
But as expected the commands do not interact with the desktop, but this was enough for what my application needs to do.
Sorry for the poor answer.
Related
Goal:
I periodically upload new .exe file to windows server 2003 via FTP and I want to run it manually by hitting Url of a web site on same server. Exe needs to be run under an Admin account, and not the NETWORK SERVICE account.
What I achieved so far:
I have been able to successfully run applications like notepad under the Admin account on the server via a web request by using any of these:
PsExec,
.net process.Start() with credentials supplied to process.StartInfo and even
by impersonating admin and then using process.Start without credentials (http://www.f4cio.com/programmatically-impersonate-in-csharp)
The problem:
The above methods run my exe but Task Manager, or a call to System.Security.Principal.WindowsIdentity.GetCurrent().Name shows me that it is running under NETWORK SERVICE.
I suspect that this file has added security constraints because it arrived from ftp link. Checking run-as-administrator in properties of file is not an option because file will be replaced periodically and all needs to be automated. Also manual server configuration should be minimal or ideally non-existent. Code-only single-web-page solution is ideal. Editing both that asp.net web page and exe is ok. (I tried something with exe self-restarting).
Not sure about this, but I suspect this has to do with you website running under the NETWORK SERVICE user. Whatever privileges your website-user has, the same are probably granted / passed on as you try to run your executable.
Is this server on an internal network or protected in some other way? (I should hope so!). If so, you might try changing App Pool that the website is running under to an admin account (in IIS, right click the App Pool running the site, select Advanced Settings, and look for the Identity setting). If I'm right, that will allow you to run your executable as an admin too.
Be aware however, that this may increase the security risk of your setup: Allowing your site to run under an admin account means easier access to your entire server if anyone is able to penetrate whatever security measures you have in place. Make sure access to this server is tightly limited, and preferably, that it in turn does not have access to other systems, since that would in turn make them vulnerable by extension.
I have a test gui(winform) which I use to test my wcf service. The service callĀ“s another project in my solution which uses some windows api methods(user32.dll) to find word dialog boxes. It works fine when I test it locally, but when I setup my wcf service in the iis and test it with soapUI, it fails to retrieve and do the desired action on the word dialog boxes.
I suspect that because I am using a winform to test the service, so when I run the test form the solution creates instances/handlers so the windows/dialogboxes are at my disposal in the solution. Testing the service alone without creating the test winform does not make the service get the dialogboxes...
Could this be a permission issue in the iss or somewhere else? I have tried to grant the worker process admin rights, but maby I am not granting the rights in the wrong place. I need find out how the service alone can get a hold of the windows/dialogboxes with user32.dll methods?
windows 7 pro, iis7, vs2010
Any help is greatly appreciated.
Your approach is completely wrong. It works under Visual Studio because it's runing under your user account, but once deployed in IIS, it runs in the context of the App Pool account, which has limited rights and can't interact with Desktop.
Even if you run the service under an Admin account, which is a big security flaw, it will only work with local windows, never with windows on remote machines.
If you explain better your requirements maybe we could suggest a better approach for this.
I have developed a TCP Server. I want my TCP server to be running even when I log off my machine. So clients can connect to it even when my computer is logged off. I was thinking if I must create a Windows Service to implement this approach, but I am not sure how to do so.
Please tell me how can I let my application to keep working even when my machine is logged off.
You can create a service by following these instructions:
http://support.microsoft.com/kb/251192
And then installing it to your PC should be as simple as using
installutil MyService.msc
(installutil will be part of your .NET installation, eg in C:\Windows\Microsoft.NET\Framework\v3.5)
You can the configure it to Startup Automatically by running services.msc from the command prompt.
You could launch it as a task from Windows Task Scheduler and set it to run even if you aren't logged in. This would work even if the application isn't a service.
If you want to be able to shut down your machine and still let the client connect then you need to deploy your application on a server.
Create a windows service and run it as LocalService http://msdn.microsoft.com/en-us/library/zt39148a(v=vs.80).aspx
I am facing a strange issue with my site in IIS 7. I have 10 sites with different sub-domains hosted on IIS 7. I am using .NET framework 3.5 and SQL Server 2008 R2. Three sites I have configured on DefaultAppPool while for others I have created separate application pool for each and configured them with their specific.
I allows user to upload video, after upload completes I used to hint it (a process to make bit rates of video equal for on-line streaming on android) using MP4BOX - a command line interpreter, with server side code.
What issue I am facing is while using DefaultAppPool the MP4BOX works fine but when I configured site to its specific appPool, MP4BOX stops working. I have go through the settings but haven't find any issue. Can anyone help me to overcome this issue.
Awaiting for your valuable response.
Resolved it myself by assigning read/writes permission to the application pool to the directory.
After lots of research I have found that it was happening due to read/write permission of this exe to the specific directory. MP4BOX need to have read/write permission to create video file in the IIS directory. So I have added application pool as a user to the specific directory to which mp4box was accessing for read write.
I have an executable file that works fine by hand locally. It converts a file to another new file by some parameters. I'm using ASP.Net and that executable installed win2003 server
sp2. I can use it from local but, I can't execute the program from a web browser using system.diagnosting.process. When I use that, I can see the process in task manager with user name "NETWORK SERVICE", and it won't dissappear without ending process by hand and won't work.
I tried impersonation, try as a web service, edited local policies, apply all privilages, etc...
Is there any suggestions about this problem?
How about creating an app pool in IIS. Assign it the local account ('by hand locally') . Assign the application to this newly created app pool and see if it works.
You can also use procmom to see why the original process hung under "NETWORK SERVICE", probably registry access or something else.