How to limit resources (RAM and Space) for a website hosted on IIS7 platform?
Thru the GUI, you can set them under Application Pools > [AppPool] > Advanced Settings - Recycling
Thru command line:
appcmd set config /section:applicationPools /[name=' string '].recycling.periodicRestart.privateMemory: uint
Related
I have a website with a virtual directory that contains PDFs.
Users access the PDFs by using a URL such as http://myApp.com/PDFs/12345678.pdf, where PDFs is a virtual directory mapped to \\\actualPhysicalServerName\PDFsDirectory\.
This works.
I routinely re-deploy the application. Once the application is redeployed and the website restarted, users can no longer access the virtual directory until IIS is restarted.
Accessing the above URL gives the following error:
An error occurred loading a configuration file: Failed to start monitoring changes to \\\actualPhysicalServerName\PDFsDirectory\web.config because access is denied.
at System.Web.FileChangesMonitor.FindDirectoryMonitor(String dir, Boolean addIfNotFound, Boolean throwOnError)
at System.Web.FileChangesMonitor.StartMonitoringFile(String alias, FileChangeEventHandler callback)
at System.Web.Configuration.WebConfigurationHost.StartMonitoringStreamForChanges(String streamName, StreamChangeCallback callback)
at System.Configuration.BaseConfigurationRecord.MonitorStream(String configKey, String configSource, String streamname)
at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
Restarting the application pool does not help.
I have to restart IIS.
Once IIS is restarted, the virtual directory can be accessed as expected.
Is this expected behavior? Have I set up my virtual directories incorrectly?
I am using IIS 7.5, Windows 7 server, and .NET 4.5.
I solved this problem this way:
Created new pool with "No managed code" and "Classic" settings.
Converted virtual directory to application, connecting with a user account with permissions on the share
Have application use the new pool
For anyone else frustrated with the same issue - while I did not find the crux of the problem, I did figure out that this problem was related to the Identity of the Application Pool that the website was running under.
In my case, the solution was to change the App Pool identity from the ApplicationPoolIdentity Built-in account to a custom account that is an administrator on all of the machines involved.
To do this
Right click on the application pool in IIS, Choose Advanced Properties.
Under ProcessModel->Identity , choose Identity. Choose Custom Account (Built-in account, Application Pool Identity is the default in IIS 7.5)
Switch to using a Custom Domain account, that is an administrator on this machine, as well as the machine where the virtual directory is hosted.
Restart the Application Pool.
I had a Virtual directory pointing to images on UNC share. All was working fine until we updated parent app to .NET 4.5.
We had to convert the VirDir to Virtual Application with 4.0 Integrated Application Pool.
Old topic but I was able to solve it by following these instructions (basically add ASPNET and IUSR to permissions:
In Windows Explorer, browse to the application folder or to the virtual directory that contains the content (for example, c:\inetpub\wwwroot\xx).
Right-click the folder, and then click Properties.
On the Security tab, click Add.
On the "Select Users or Groups" window, click on Advance
Click on Find Now button, you will see List of users
Select ASPNET and IUSR_(machinename) then click OK to close the"Select Users or Groups" window
Allow the following permissions for the ASPNET and IUSR_(machinename) account:
-Read & Execute
-List Folder Content
-Read
When I start site from visual studio(F5) - it works normal in browser.
But when I start it from IIS Manager - it always shows standart IIS page with languages.
Site uses database DB.mdf. In web config connection string is
Data source=.\MSSQLSERVER2;Database=DB;Integrated security=true
The database is in App_Data.
In IIS manager in ASP.NET->Connectionstring for my site I've create new connectionstring - same as the connection string in web.config with name CName.
Where is a problem? The path to my site is the path to catalog which contains App_Data catalog.
When running in IIS, it uses the security context of the Application Pool it's running under. You will either need to use a different user on your App Pool Identity, or grant rights to your resources to the current App Pool user.
See this article on how to setup the App Pool identities.
I Have an asp.net web application that access files on shared folder from remote host,
when the web application is run from vs2008 it retrives the image files and display them.how ever when i deploy the same project in IIS using virtual directory, the application couldn't access the files on the shared folder it says access denied.
is there any persmission setting i needed to add, I have already add the Asp.net and network service to the project files on the phsical path where the virtual path is pointing too.
string pic3 = #"\\M37350\temp\GraphicUserImage.jpg";
FileInfo f = new FileInfo(pic3);
if (f.Exists)
{
Image1.ImageUrl = pic3;
Image1.Visible = true;
}
Thanks.
VS2008 is using your credentials when executing web application. You will need to set up an account (one that has access to the remote folder) in your IIS virtual directory.
you'll need to set the Application Pool's Identity to a domain account (domain\user) with access to this shared folder, the built-in "Network Service" account doesn't have access to a remote shared folder.
To change your App Pool Identity:
you'll need to know which Application Pool your website is using by going to the Website properties "Home Directory" tab (Application Pool is the last item)
Close out the Website properties and under Application Pools in IIS find the corresponding Application Pool, open properties and go to the "Identity" tab to change the user.
Might also check this answer on serverfault.com: Permission for ASP.NET application on web server to access shared folder on another server
And this step by step for setting custom app pool identity ASP.Net and IIS Support Team Blog for Microsoft France
You need to chmod the shared folder so it is readable and writable to you and/or others. Usually the host has an interface for this. As far as I know, the permissions cannot be set from code.
I have a Continuous Integration server with dozens of ASP.NET applications hosted on IIS. Everytime I want to deploy a new application, I have to create a new Website or virtual Directory and configure it as an application in IIS.
I would really love to have only one website listening in a specific port (say, 80) serving multiple ASP.NET sites according to wildcard host headers.
For instance:
*.dev.mydomain.int -> my server's ip address (eg: 192.168.1.32)
IIS web site reads the host header and try to find a local folder with the same name. Ex: when a request uses the host header "helloworld.dev.mydomain.int" IIS tries to open a preconfigured folder appending the host header site name (e.g: D:\dev\helloworld)
IIS serves the contents of the folder as an ASP.NET application, using preset configurations (Application Pool, ASP.NET version, and so on).
My goal here is not to create a web site or virtual directory for each and every project in our CI server. I know I can create them programmatically, but I'd prefer a more dynamic solution.
Thanks in advance
You can use MSBuild tasks to create Virtual Directories / Web sites automatically.
http://fczaja.blogspot.com/2009/02/automatic-deployment-of-webapp-on-iis.html
I had it working on a large application with many branches (we had an environment for each branch) and I didn't have to open IIS settings at all. Just pure hands-off process.
This one is killing me. I have an ASP.net (2.0 Framework) app that uses integrated security. IIS is setup appropriately and works fine as a virtual directory off the default website. My OLEDB connection (Jet 4.0) works fine and connects to a database file via network share (\GIS1\GIS Server - PublicWorks_StreetSigns).
BUT, when I create an IIS "website" and point it to the exact same home directory I get an error...
Error getting data from DBF. '\GIS1\GIS Server - PublicWorks_StreetSigns' is not a valid path.
Do I have to do something different in a website versus a virtual off the default website to make this work? I've triple checked the virtual settings against the website settings and everything is the same.
Thanks in advance.
I would check the identity of the application pool servicing each website. My guess is that the default identity of the app pool doesn't have permissions to that path.