IIS - tempory config file overwrite DefaultAppPool.config - iis

I'm working aroung IIS config files.
I want add some IIS IP address restrictions at server level, that spread over all the IIS appPolls
If I work with IIS Manager all work fine, I'm able to add any config settings. But if I want modify/add them directly on .config file it is no possible.
I can see that the settings made by IIS Manager are written on a temporary .tmp file under C:\inetpub\temp\appPools and then overwritten on DefaultAppPool.config under C:\inetpub\temp\appPools\DefaultAppPool
If I try to manual modify DefaultAppPool.config it don't take effect on IIS Manager and if I make any changes on IIS Manager it is overwritten. If I try to manual modify the tmp config under C:\inetpub\temp\appPools I'm informed that the file is in use.
I've also try to work with applicationHost.config under C:\Windows\System32\inetsrv\config, but it does not seem to match the configuration displayed on IIS Manager.
So how can I edit the IIS configuration file manually at the server level?
I've to add a lot of IP restrictions and the only way is to add them directly on .config file.
Very thanks for any help

That is the temporary file. if you want to change the iis configuration at the server level then you could modify the iis applicationhost.config file.
ApplicationHost.config is the root file of the configuration system when you are using IIS 7 and above. It includes definitions of all sites, applications, virtual directories and application pools, as well as global defaults for the web server settings (similar to machine.config and the root web.config for .NET Framework settings).
Open notepad as administrator and open applicationhost.config
add below code in the config file:
<ipSecurity allowUnlisted="true">
<add ipAddress="192.168.2.52" allowed="true" />
</ipSecurity>
https://learn.microsoft.com/en-us/iis/get-started/planning-your-iis-architecture/introduction-to-applicationhostconfig

Related

How to import IIS settings that were exported from the `Shared Configuration` section?

I have exported the IIS settings from the Shared Configuration section.
I believe that the exported file contains all the IIS settings, app pool/settings, website/settings which can be restored onto another IIS server to replicate the configuration (for example - in case the 1st server crashes permanently).
How to import them onto another IIS?
When we Export the configuration and if you have stored it on the network drive(shared location) it will create 3 files like below.
You could check Enable Shared Configuration option and pass the shared location path and credentials.
It will give you some pop-ups, you could read them and take action.
After that, the configuration will be taken from those files.
Reference: Shared Configuration

When does web.config get validated?

As for IIS, I have a PHP app, and I am using web.config for configuration.
When I change settings in web.config, shall I restart the server? or just refresh my webpage and expect settings to take place?
You don't need to explicitly restart server. Web.config is special file, any changes in it are watched FileWatcher and app pool is restarted automatically when you do changes in this file. So your app pool restarts on following things.
Any changes in web.config
Any changes in machine.config
Any changes in global.asax
Anything changes in bin directory or it's sub-directories

IIS Configuration mystery -- keeps resetting from some default config file?

I have an IIS installation with three websites. I'm using Zend PHP -- each site is being directed to it's own PHP.ini file. My problem is this -- whenever I go into IIS to make a change, or restart IIS, the server, or mess with any configuration settings at all, IIS is saving my changes to the:
C:\Windows\System32\inetsrv\config\applicationHost.config file.
...but then it's is pulling an earlier configuration and IIS it referencing it as the config. This blows up the sites, tells me each site is trying to use the same configuration and gives an IIS error. I found that this file it's overwriting everything with is in the C:\InetPub\Temp\appPools[somename].tmp
This file is locked -- I can view it in a text editor, but can't make a change to it. It's taking the config in this file, then pushing it to another folder:
C:\InetPub\Temp\appPools[SiteFolder][site].config
I can take the config from applicationHost.config, and shove it into the site.config, and it fixes my problem -- but only until the next change is made...then that file gets overwritten again. I have many other servers with sites set up like this, and any changed made within IIS is written to applicationHost.config and properly referenced by IIS.
In IIS, if I view "CONFIGURATION: SEARCH CONFIGURATION", I pull up the applicationHost.config file and it shows this 'default configuration, and the path shows:
C:\Windows\System32\inetsrv\config\applicationHost.config
But what it shows in IIS doesn't actually match what is actually in that file. If it wouldn't then everything would work. I'm sure this is confusing -- but if anyone can help lead me in the right direction, I'll really appreciate it :)

IIS : What directories generate app restarts when files are changed?

I am aware that any change to ANY file in the BIN directory will trigger an application restart in IIS. Are there any other "special" cases where changing a file or moving a file in any other directory will trigger an app restart?
I know this is a very old post, but may be helps someone:
See this: http://programming360.blogspot.com/2009/04/what-causes-application-restart.html
ASP.net run-time environment implements a good deal of checks and automatically restarts an application if any of the following scenarios occur:
The maximum limit of dynamic page compilations is reached.
The physical path of the Web application has changed, or any
directory under the Web application folder is renamed.
Changes occurred in global.asax, machine.config or web.config in the
application root, or in the Bin directory or any of its
subdirectories.
Changes occurred in the code-access security policy file, if one
exists. Too many files are changed in one of the content directories.
(Typically, this happens if files are generated on the fly when
requested.)
Changes occurred to settings that control the restart/shutdown of the
ASP.NET worker process. These settings are read from machine.config
if you don't use Windows 2003 Server with the IIS 6.0 process model.
If you're talking full advantage of IIS 6.0, an application is
restarted if you modify properties in the Application Pools node of
the IIS manager.
If you change the web.config you app domain should also be reloaded and assemblies flushed.

I cannot access files in IIS 6

I have a default IIS 6 install and I can access only .html files. If I create a html file I can see it on the browser. Any other files like ini for example are not visible (404). Any idea on what can be the issue?
Check the web service extensions are enabled (in IIS below the websites is a folder for them) for the content you are trying to share.
Check that the handler mappings is setup correctly (on the website properties)
This may help :
IIS & ASP.NET blocking file

Resources