How to get a promission on desktop to interactive with IIS7 processing? - c#

I have a WCF (C#) installed on a server that execute xxx.exe file.
The xxx.exe using c++ CreateWindow and write txt file.
I already find a lot of solution ...
How to execute exe form asp.net ?
Unable to Start a Process from ASP.NET
I can start a process from ASP.NET using System.Diagonistics.Process.Start method. Process start in the background ,but I can't see it in the desktop.
I can't find iis admin service and "Allow Service to Interact with Desktop check box" in the services.
Server:
Windows 7 64bit
Internet Information Services 7
.NET Framework 4.5
WCF:
using System.Diagnostics;
Process.Start(#"D:\xxx.exe", "");
local services:

go to start, in the search box type "local services", open that program and find IIS Admin Service, click Log On tab there is a radio button group called Log on As and a check box "Allow service to interact with desktop"
You may have to restart service and IIS.
EDIT:
If you can't see the Admin Service in local service, then you will have to enable it in Windows Features under Internet Information Services -> Web Management Tools -> IIS6 Management Compatibility -> Check All
EDIT
Try with processinfo
ProcessStartInfo startInfo = new ProcessStartInfo(#"D:\xxx.exe");
startInfo.WindowStyle = ProcessWindowStyle.Normal;
Process.Start(startInfo);

Related

Unable to run selenium in Jenkins [duplicate]

When I run my selenium test (mvn test) from jenkins (windows) I see only the console output. I don't see the real browsers getting opened . How can I configure jenkins so that I can see the browsers running the test?
I had the same problem, i got the solution after many attempts.
This solution works ONLY on windows XP
If you are using jenkins as a windows service you need to do the following :
1) In windows service select the service of jenkins
2) Open properties window of the service -> Logon-> enable the checkbox "Allow service to interact with desktop"
After then you should reboot the service jenkins
Hope this help you :)
UPDATE:
Actually, I'm working on a an automation tool using Selenium on Windows 10, I've installed Jenkins ver. 2.207 as windows application (EXE file), it's running as windows service and ALL drivers (Chrome, FireFox, IE) are visible during test executions WITHOUT performing a mere configuration on the System or Jenkins
I got the solution. I ran jenkins from command prompt as "java -jar jenkins.war" instead of the windows installer version. Now I can see my browser based tests being executed.
If you are already doing what #Sachin suggests in a comment (i.e. looking at the machine where Jenkins actually runs) and still do not see the browsers, then your problem may be the following:
If you run Jenkins as a service in the background it won't open apps in the foreground. You may either try to run it not as a service in the foreground, or run it as a Local System account and check Allow the service to interact with desktop option. In the latter case you may get into permission problems, though.
Update: To make sure this answer is understood properly by others: Jenkins Windows 'native' installation is not really native. It's a wrapper around Java that runs it as a service.
To interact with desktop GUI, you should launch slave agent via JNLP:
https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds#Distributedbuilds-LaunchslaveagentviaJavaWebStart
After adding the node in Jenkins (configured as Java Web Start launch), just make a startup batch script on the node machine:
java -jar slave.jar -jnlpUrl http://{Your Jenkins Server}:8080/computer/{Your Jenkins Node}/slave-agent.jnlp
(slave.jar can be downloaded from http://{Your Jenkins Server}:8080/jnlpJars/slave.jar)
See more answers here:
How to run GUI tests on a jenkins windows slave without remote desktop connection?
In the case of Windows 7 you should not install jenkins as windows application (because in this recent version, Microsoft decided to give services their own hidden desktop even you enable the functionality "interact with desktop" in jenkins service), you may have to deploy it from a war file as follows:
1) Download jenkins.war from Jenkins official site
2) Deploy it by the command prompt : java -jar {directoryOfJenkinsFile}/jenkins.war
3) Now you can access jenkins administration on http:// localhost:8080
Hope that helps you !
this is an issue for Jenkins. on Windows it is possible to access logon user's session (screen) under system account. to make the UI testing visible, Jenkins needs to bypass UAC (user access
control) at background. this solution works for me with my own service running as system account.
I also faced the same issue earlier in my local machine (Windows 10).
My test was running perfectly from the NetBeans but when I moved to Jenkins it was only running in console mode. I was unable to view the UI.
So for that, you just need to make your local machine as a Jenkins slave by creating a new slave node in your Jenkins and select that node to execute the Jenkins job.
If jenkins installed by windows installer it is showing only Console out put only. To see browsers download jenkins.war file and run java -jar jenkins.war from command line.
Go through this site:
http://learnseleniumtesting.com/jenkins-and-continuous-test-execution/
If you have the following situation,
You are able to login to the remote machine
You don't see the Jenkins agent window
This slave machine is accessed by many users then try the following,
then try the following suggestion.
Login to slave machine
Go to Task manager
Users
Logout all the users
Then login again.
This worked for me.

Silent install msi from a windows service local service account

I am building an auto-updating mechanism. A windows service that runs on a local service account responsible with the auto-updating of a msi.
The service downloads the msi file then it tries to install it using this code:
Process process = new Process();
process.StartInfo.FileName = "msiexec.exe";
process.StartInfo.Arguments = string.Format(" /i \"{0}\" /qn /norestart ALLUSERS=1", sMSIPath);
process.Start();
process.WaitForExit();
Where sMSIPath is a string representing the path to the file, for example "C:\test.msi".
This code, from a regular console application seems to be running fine. I managed to silently install adobe reader, for example.
But from my windows service, it does nothing. According to the logs, i get a warning with this message:
Failed to connect to server. Error: 0x80070005
Where the user is "LOCAL SERVICE" (as i mentioned, my windows service runs as a local service).
Also, the projects have target x86, but i am running a 64-bit OS. (i need them at x86, i want this software to be able to run on multiple operating systems).
Any help is very well received.
Thanks alot!
I don't think you have much chance of making this work. If the MSI tries to access folders like Desktop, User's Program Menu, the CommonFilesFolder (not a complete list) or looks at the LogonUser property and any number of other things it will fail because in a normal install from the interactive user these are all valid properties associated with that installing user. When the installing user is localservice you're likely to be in a mess.
If you need to do this, configure the service to run as a valid administrator account - that might give you a chance of it working better. It's possible that the failure to connect to server error is because MSI files are expected to be run from some kind of user account.
Open service management console Start->Run->Services.msc
Right click on your service and go to properties
On property page select second tab i.e. "Log On"
Check checkbox called "Allow Service to interact with desktop".
Harry Johnston is right, local service doesn't have the privileges to do that. Local system works great though, so i'll use a local system account.
Thank you for your answers, they were all helpful!

IIS 8 - Launch exe on server via ASP.NET

I'm trying to create a webapplication for my local network.
I've installed IIS 8 on a PC and I'm hosting an ASP.NET C# application on it.
Now I would like to launch an exe-file on the server, when the user clicks a button in the asp.net application.
I've created a new application pool for the webapplication.
Now I'm launching the exe with the following code:
Process process = new Process();
process.StartInfo.FileName = #"C:\Windows\notepad.exe";
process.Start();
If I check the task manager, I can see that the exe is running in the background.
Unfortunately, it doesn't show up on the desktop.
Obviously, there is a problem with permissions for the IIS service.
Can you help me with the configuration of the permissions?
Thank you,
Sandro
This is no longer possible in Windows Vista/Windows Server 2008 or later. To help prevent what are called 'shatter' attacks - where an attacking program sends a message to a privileged service's window, that exploits a vulnerability in that message handler - the 'interactive' session is isolated from real desktops. Microsoft call this Session 0 Isolation. There are some application compatibility measures for legacy services.
On Windows Server 2003 and earlier, it will only work if the user is either logged on at the physical console, or using a special switch to Remote Desktop to tell it to connect you to an administrative session. For Remote Desktop 6.0 or before (before XP SP3 or Vista SP1) you use the /console switch. For Remote Desktop 6.1 or later (included in XP SP3 and Vista SP1), use /admin. Other remote access utilities project the physical console session.

IIS debugging in windows 2012 server IIS 8.0

Am trying to debug the web application hosted in windows server 2012 with IIS 8.0. I opened VS2008 with the code and i Attach process but no W3Wp.exe process is listed there.
In task manager i can see the w3wp.exe under details tab not in Procees tab. In process tab IIS worker Process is listed.
Checked all users and all sessions as well
Please let me know how i can debug.
Thanks
Ticking 'Show processes in all sessions' showed it for me

System.Diagnostics.Process.Start not work with IIS, but on ASP.NET Development Server

I am using VS2008 C# and testing on my local XP Pro PC with local IIS, I have wrote a web service to call a third party software .exe file to use svn checkout commands to insert data into a folder, which use System.Diagnostics.Process.Start . The same codes did work when I use VS2008 build-in ASP.NET Development Server(http://localhost:2999/MyServices/MyServices.asmx). but when I use IIS normal URL(http://developer/MyServices/MyServices.asmx) to run Process.Start on the web service, it just haunlted and not doing anything.plz send one sample program.
This is most likely down to the user being used to run the code. When using the built-in server, it is running as the same user as Visual Studio is running as. When in IIS, it will be running as the MACHINENAME\ASPNET user.
If the process you are starting cannot execute as the MACHINENAME\ASPNET user, it will not work when hosted in IIS unless you change your configuration to change the user it runs as. See this page for more info on what users are used for what in IIS.

Categories

Resources