Any idea which account IIS uses to run asp.net project. My project or code access file which is in C:\path\path directory. When I test the project in my machine it runs fine (well I am running in built server; Cassini) but when I test the same project in development server where it uses IIS 6.0 ... my code throws a exception "Access to the file C:\path\path is denied".
Not sure how can I solve this? any idea?
Thanks a lot.
Rahul
Find the identity used by the application pool your web application runs under. Here are steps for IIS 6:
Click Start | Run...
Type inetmgr, click OK
In the left-hand pane of IIS Manager, browse to your web application, e.g., My Server | Web Sites | Default Web Site | My Web App
Right-click on the web application, click Properties
In the general tab, note name of the the selected Application pool. Click Cancel
Go back to the left-hand pane of IIS Manager. Browse to My Server | Application Pools | My Application Pool, where My Application Pool is the name you found in step 5, above.
Right-click on My Application Pool, click Properties
Click on the Identity tab. This shows the identity that your web application is running under.
Use the IIS Manager to verify which Application Pool that is running the site you want to investigate.
If you look at the properties for the Application Pool, there is a tab named Identity in which you can determine what user is set to run the process.
You can also use the Task Manager to see which user is running the process named w3wp.exe, which is a process running an instance of IIS (or an Application Pool, in fact).
Related
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
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
How to set the Application Pool for a Virtual directory in IIS 8 on a Windows 2012 server?
Application pool can be set to an application and not to a Virtual Directory.
The following steps will create an application pool named TestPool.
Open Internet Information Services Manager.
Click Start > All > Accessories > Run.
In the Open box, type inetmgr and click OK.
Expand .
Right-click Application Pools and select Add Application Pool.
Provide the required details on the Add Application Pool dialog box.
Name: TestPool
.NET Framework version: NET Framework< Version>.
Managed pipeline model: Integrated
Start application pool immediately: Checked
You need to first convert your virtual directory to application first. For that right click on virtual directory then select "Convert to Application".
In Add Application dialog box, default application pool is shown here, if you want to change it you can change by clicking the Select button.
Select the pool required and save the changes made.
I have an asp.net mvc 4 web application , and I use the visual studio publish feature, to publish my web application to the localhost iis. But currently if I type the web application URL it will not work unless I open the VS and run the application. so can anyone adive how I can publish my web application on IIS so users can access the web application event if the VS is not running .
Thanks
Publishing a website to your Inetpub\wwwroot is not recommended on a standard computer, you will need to host your application on a server. Windows server has no limit on the amount of connections allowed to your webpage, whereas your computer can only handle a maximum of 10 connections.
if you want your solution to work outside of VS but still on your computer, you will have to create a virtual directory within IIS or within VS (then VS will do it in IIS for you).
Right click on your project, go to the "web" tab, there is an option there to host it within IIS and a button that creates the virtual directory for you.
Also check that you then have an application pool set up and running the correct version of .NET (depending on the framework you created the application in)
I have iis 7.0 which each app pool running one website. however, some worker processes hve username: network service which i have no idea what apps they are running.
Is it possible to find them out ?
Thanks.
You can look at each website / application in IIS Manager and check what application pool they are using.
Foreach web site and applicaiton:
Select the site / application in IIS manager and select "Basic Settings". The name of the AppPool should be in the properties dialog that is displayed.
Would that be good enough?