Calling windows application exe within web service method - asp.net

I have 1 web application 1 web service and 1 windows application and I am calling a web service method from web application and in that method i am calling windows application exe. I have put windows application exe on server machine and also host that web service on server machine. If I the web service is hosted on local iis then its working and if it is on server IIS then it gives me Time Out error

Web service executes in the context of the ASP.NET worker process on the Web server. If you use the Process.Start method in an ASP.NET Web page or server control, the new process executes on the Web server with restricted permissions.
Give permission for ASP.NET worker process account to interact with desktop or allow ASP.NET worker process to run in SYSTEM account.
Open Control Panel and follow these steps: For Windows NT: click Services. For Windows 2000, Windows XP, and .NET Server: click Administrative Tools, and then click Services.
Double-click IIS Admin Service.
On the Log On tab, select the Allow Service to Interact with Desktop check box. Remember to run IIS Admin Service as a local system.
Stop and restart the IIS Admin Service.

Related

How to set IIS users/permissions to execute a Process.start() in the web application?

I have a powershell script file called Script1.ps1 And I execute it from a web application in ASP.NET with the following code:
process.StartInfo.FileName = #"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe";
process.StartInfo.Arguments = $"-File \"{ScriptNameOne}\" \"{param1}\" \"{param2}\" \"{param3}\"";
process.StartInfo.UseShellExecute = true;
process.Start();
The problem is when I deploy my web app in IIS the process doesn't start.
I don't get any error, just my powershell doens't run.
the code works fine in my IIS express from visual Studio, because my user in the computer is executing all the process, so I have permissions to every source in the machine.
Important: I need to execute this powershell script LOCALLY IN THE SERVER WHERE THE SITE IS.
I know that is user/permissions Issue, so...
In IIS, which permissions do I need?
What of all IIS users should I use?
Do I need give permissions in the folder where the powershell.exe is?
ASP.NET Web page and server control code executes in the context of the ASP.NET worker process on the Web server. If you use the Start method in an ASP.NET Web page or server control, the new process executes on the Web server with restricted permissions. The process does not start in the same context as the client browser, and does not have access to the user desktop.
Give permission for ASP.NET worker process account
to interact with desktop or allow ASP.NET worker process to run in SYSTEM account.
To know how to allow worker process to run in SYSTEM account and to know the default permissions of ASPNET account, check this article INFO: Process and Request Identity in ASP.NET: http://support.microsoft.com/default.aspx?scid=kb;en-us;317012
Enable IIS Admin Service to interact with desktop
To configure this, follow this steps.
a. Open Control Panel and follow these steps: For Windows NT: click Services. For Windows 2000, Windows XP, and .NET Server: click Administrative Tools, and then click Services.
b. Double-click IIS Admin Service.
c. On the Log On tab, select the Allow Service to Interact with Desktop check box. Remember to run IIS Admin Service as a local system.
d. Stop and restart the IIS Admin Service.
More infor about this question you can refer to this link: https://stackoverflow.com/a/4679686/13336642.
WHAT WORKED FOR ME:
Right click the directory where the .EXE file is and select Properties
Select the Security tab
Click the Edit button and then Add button
Click the Locations button and make sure that you select your computer
Enter IIS AppPool<appoolname> (eg: IIS AppPool\DefaultAppPool)
https://support.pkware.com/home/smar/latest/sem-knowledge-base/kb-granting-folder-permissions-to-iis-application-pools

Invoke windows service from asp.net web app on iis

I want to start a windows service from asp.net webform which are deployed on the server . It gives error cannot control service on this computer
You have to use the impersonation to control your windows service from asp.net application. To access the windows service from web application required some access rights on machine where you have installed the service.
Please check this link it may help

Asp.net process.start own issues

I have a asp.net application where I am using running process.start. it runs on my pc but not the server.
I have read that I needed to give my iis worker permission to run interactivity with the desktop however this still is not working.on my server the asp.net app is under its own application pool. How do I give my application pool access to run the process.start?
Give permission for ASP.NET worker process account (\ASPNET) to interact with desktop or allow ASP.NET worker process to run in SYSTEM account.
To know how to allow worker process to run in SYSTEM account and to know the default permissions of ASPNET account, check this article
INFO: Process and Request Identity in ASP.NET (http://support.microsoft.com/default.aspx?scid=kb;en-us;317012)
2. Enable IIS Admin Service to interact with desktop
To configure this, follow this steps.
a. Open Control Panel and follow these steps:
For Windows NT: click Services.
For Windows 2000, Windows XP, and .NET Server: click Administrative Tools, and then click Services.
b. Double-click IIS Admin Service.
c. On the Log On tab, select the Allow Service to Interact with Desktop check box.
Note: This article assumes that the IIS Admin Service runs as a local system.
d. Stop and restart the IIS Admin Service.
Then you need to change you Application Pool Identity to Local Service. Start and Stop Application Pool and Website.
Then this will work

virtual server to run asp.net project without visual studio

i make a web application in asp.net and this application will run on multiple computers on small network without server client ... and i need to run it without using visual studio
because the user is not asp expert ... so how to do that ??
is there is a way to make a virtual server or to run localhost ??
my web application within this path :
C:\Users\Samy\Documents\Visual Studio 2010\Projects\Redcrescent\PrecompiledWeb\Redcrescent
login.aspx the firstpage
You can host the web application on your local machine.. yes, you will need to set up IIS and configure it to do so. Then you would publish the web application to IIS.
You can google how to set up IIS on Windows 7 or whatever operating system you have.
This link will help as well.

How to pass on user's identity from web application hosted in one IIS to the web service hosted in another IIS?

I have a web application (developed in ASP.net 4.0) hosted in IIS 6.0 on Windows Server 2003 R2 machine. Integrated Windows Authentication is turned on for this web application.
I have hosted a web service (developed using WCF) in IIS 7.5 on Windows Server 2008 R2 machine. 'Windows Authentication is enabled for this web application too.
I log on to my local machine using my windows domain account. When I browse the web application, it asks me my domain username and password. In web app, I get my identity correctly.
From my machine (using some other Winform app), if I call the same web application (of a web service), service code executes under my windows identity.
So Integrated Windows Authentication works fine independently for both the web apps hosted in separate IIS on different machines.
Problem comes when the web application is browsed from my local machine and web page calls the service internally. In this case, "service does not run under my windows identity" as expected. It either runs under identity of the application pool of either asp.net web app or the web service's web app.
I don't want my web service to take responsibility of authenticating the user. It would use simple basicHttpBinding. It will just read name of the user using CurrentPrincipal or HttpContext etc. Validating user's identity should be done by the IIS only.
Can someone help me to pass on my windows identity from one IIS to another?
You need to set up kerberos delegation as identity won't be passed to another machine by default.
https://web.archive.org/web/20190419225807/https://blogs.technet.microsoft.com/askds/2008/11/25/fun-with-the-kerberos-delegation-web-site/

Resources