Deploying asp.net mvc4 to IIS 7.5 locally - asp.net

I'm trying to deploy my ASP.NET website locally to IIS 7.5 on Windows 7, and I keep receiving the same error. I've never deployed to IIS before.
Error:
Authorization: Cannot verify acces to path (c:\inetpub\wwwroot\website)
Message:
The server is configured to use pass-through authentication with a
built-in account to access the specified physical path. However, IIS
Manager cannot verify whether the built-in account has access. Make
sure that the application pool identity has Read access to the
physical path. If this server is joined to a domain, and the
application pool identity is NetworkService or LocalSystem, verify
that \$ has Read access to the physical path.
Then test these settings again.
I'm using the .NET Framework 4.0.30319

It was to do with the permissions set in the Application Pool, they must be correct in order for the application to run locally on IIS.
Application Pools
-> Right click Pool
-> Advanced Settings
-> Process Model
-> Identity
And my identity was set to the email used for the particular application

Related

Spoof IIS Express App Pool Identity for Integrated Security

In order to keep application secrets out of source code I want to use Integrated Security to connect my ASP.NET MVC application to SQL Server. However, IIS Express uses my development machine's account as the Identity for Integrated Security, which has different permissions from the AppPoolIdentity on production. I want to connect to SQL server using the same permissions in development as in production, which seems like something that should be easy to do, but I have had no luck.
Apparently it is impossible to set the Identity used by IIS Express except using "runas" which I could not get to work: how to run iisexpress app pool under a different identity
Things I've tried:
IIS Express
Create a User in "Edit local users and groups" and add it to "IIS_IUSRS" group.
Create AppPool in IIS Express manager (Jexus manager)
Setting AppPool > ProcessModel > Identity to newly created User, which fails.
(However setting AppPool Identity works in IIS Manager (not express))
Create site and configure path and ApplicationPool
Application successfully launches through Jexus manager, however still using my Windows account like it does launching from Visual Studio
IIS
Create app pool and log in as newly created user (succeeds unlike Jexus manager)
Create and configure site to use https and IIS Express development cert
Get 500 error when trying to launch the same way as with Jexus manager
I would rather launch the app from Visual Studio anyway
Impersonation
Requires credentials in web.config defeating the purpose of Integrated Security
It's important we manage secrets internally so Azure Key vault or other similar 3rd-party solutions are off the table.
It's beginning to seem impossible to configure IIS Express AppPools to use an Identity other than the currently logged in user: Link1 and Link2. The second link describes a method using "runas" from cmd as Admin but using System.Security.Principal.WindowsIdentity.GetCurrent().Name to check the ApplicationPool identity still shows my logged in Identity, not the one I used in the "runas" command.
What are my options? I would like to use Integrated Security for both dev and prod, with the same permissions on each. Is this possible? Is there an equivalent workaround?

Access to file write.lock in ASP.NET web application writing a Lucene search index

I created an ASP.NET application that uses Lucene for searching my web pages. Locally, everything works fine, but when I deploy it to the IIS server, the code that generates the write.lock file during the creation of the index, gives the following error:
Access to the path 'C:\inetpub\wwwroot\GcsWeb\OnlineHelp\write.lock' is denied.
I'm sure this has to do with the fact that the account under which the web app is running, does not have permission to write files to the web application folder.
How can I fix this? The file itself is not being created so I cannot right-click it and set the security permissions. It has to do with the fact that, maybe, it needs permission to write files, correct? If yes, then how do I do this? Not familiar with IIS security. Using IIS version 8.5 on Windows Server 2012 R2.
You need to find out from the application pool for the website what is the identity it is running under (by default this is Application Pool Identity) and grant that the correct permissions.
You can try this setting:
IIS > Application Pools > [your site] > Advanced Settings > Identity >
Built-in accound > LocalSystem
Check the user identity running the IIS app (usually NETWORK SERVICE) and ensure that user has the proper rights to the applicable folders.

Excel doesn't work in asp.net when deployed in IIS

I'm having problem integrating the excel into my asp.net application deployed in IIS. In localhost it works properly but when I deployed it in IIS it returns an error "Unable to get the Open property of the Workbooks class".
I already configured the DCOM Config Security permissions by adding Network Service and IIS in launch and activation and access permissions. I also set 'NetworkService' as Identity in IIS Application Pools but the error still persist.
How can I resolve this? Do I need additional configuration in IIS or component services?

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

User ASP.NET runs under

I'm a bit confused about how ASP.NET, what user it runs under? On iis 7.5 and on 6.0
A few of the user accounts that I'm not clear on are
Network Service
IUSR
AppPool
Any clarification on the different users would be appreciated and security considerations/etc.
In summary:
IIS 5.1 (Windows XP) - it's a local ASPNET account
IIS 6 - by default, application pools run under the Network Service account which is a member of IIS_WPG group
IIS 7.0 - still Network Service
IIS 7 SP2 / 7.5 - runs under an ephemeral thing called ApplicationPoolIdentity which maps to an account IIS APPPOOL\ApplicationPool (e.g. IIS APPPOOL\DefaultAppPool). This account is a member of IIS_IUSRS user group
ASP.NET Web Development Server (Cassini) - it's obviously your own account
And it's a good practice to create a custom low-privileged account to run your application especially on PROD environment or when you need to access the network from the application.
ASP.net by default runs underneath the IIS_IUSRS user group. So if you need to grant permission to allow your application to run, use that group.

Resources