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
Related
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
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 :)
I use NLog for logging and now I'm trying to also use it for my SharePoint solution.
How do I instruct WSPBuilder to include NLog.config in WSP and place it in the same folder as solution dll?
EDIT:
Okay, another option is to put it as Web.nlog in SharePoint 80 directory.
Do I need a separate feature for this? What should I write in elements.xml?
I don't think this can't be done - I assume for security reasons.
DLLs can only be deployed to GAC (signed assemblies only) or to the bin directory of the web application (deployed via the solution manifest, along with any required CAS policies).
If you want extra files alongside the assembly in the bin directory, you'll need to copy them manually.
Does NLog.config need to be a separate file, or can the settings be integrated into the web.config file? If you can integrate the settings into the web.config file, you can add a feature receiver and write the necessary settings during the FeatureActivated or FeatureInstalling event to web.config using SPWebConfigModifications (just google for it). You should also make sure to remove the settings in FeatureDeactivating or FeatureUninstalled event.
You should also take a look here :
http://msdn.microsoft.com/en-us/library/ee413935.aspx
I would also ask these questions :
Is the configuration the same for all the farm ? Only one web application ?
Can you programmaticaly specify NLog configuration ?
Depending on your answers, I will suggest one or more solutions.
The disadvantages with the web.config are
Configuration is deployed on all SharePoint servers (the feature take care of that, but you have to keep that in mind in case of inconsistant behavior)
If you want to modify settings there is no easy way
Each time you modify settings, it will recycle application pool.
AFAIK IIS restarts, whenever any of the web.config files is changed.
I've created my own configuration files (my.config, with slightly different hierarchy). Is there any possibility to have IIS automatically (automagically :)) restarted, whenever any of these are changed, too?
EDIT: I've considered filesystem watchers, but I'm not sure where to put them.
You mean to say that whenever you change my.config iis has to be restarted automatically.
Maybe you can write a batch file to perform your iisreset functinality alone if you dont want the user to manually restart IIS. But even if you give a batch file the user still needs to execute.
quick and ugly fix would be put config files in bin directory.
btw. I don't believe I am writing this ;)
these changes restarts web app:
* web.config
* machine.config
* global.asax
* Anything in the bin directory or it's sub-directories
copy/pasted from here Common reasons why your application pool may unexpectedly recycle
Use SomeAssemly.dll.config which will be put into ~/Bin, automatic be read on app (re)start and cause app restart on edit.
Note that App.config in project becomes $(OutputAssembly).config on build
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.