Difficulty enabling health monitoring
According to this MSDN blog, it should be quite straightforward to add health monitoring to my website by adding this:
Code:
<healthMonitoring>
<rules>
<add name="Application Events"
eventName="Application Lifetime Events"
provider="EventLogProvider"
profile="Default"
minInterval="00:01:00" />
</rules>
</healthMonitoring>
... to the <system.web> section of my web.config. However, when I do that I get this error:
Quote:
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
Any ideas what else I might need to tweak? Is the comment about it not being configured as an application likely? It's a struggle to get permission to check the IIS settings, and the website works correctly without this section in the config.
Cheers...
Re: Difficulty enabling health monitoring
So as you have noticed this error message poses 2 possible causes for the issue. The first part is basically complaining that the config setting is not permitted at the level it has been specified. By that I mean:
There are a few places web.config files exist and the sections cascade allowing settings to be overridden at different levels.
There is a web.config file in the windows directory (Level1)
%WINDIR%\Microsoft.Net\Framework\<.net version>\CONFIG\web.config
or depending on your operating system
%WINDIR%\Microsoft.Net\Framework 64\<.net version>\CONFIG\web.config
Then there is usually a web.config file at the application root directory (Level 2)
c:\inetpub\wwwroot\web.config
Next is the website directory (Level 3)
c:\inetpub\wwwroot\mywebsite\web.config
You can also have a web.config in each folder of the website below Level 3
Basically what the first part of the message is saying is that the configuration cannot be at the level it has been put. The setting from a lower level cannot be overridden.
As for the question about virtual directories and applications. In IIS is your site in a virtual directory, a separate site or an application folder.
If it is in a virtual directory under the default web site then "in some cases" this could be the issue. It would need to be in an application folder under the default website.
If it is in a virtual folder under an existing application folder then "in some cases" this could also be an issue.
If it is a separate web site then this is unlikely to be the issue.
However if none of these configurations apply and as your site works ok without the config setting it would indicate the virtual folder/application part is not relevant.
In conclusion, I suspect it is to do with the configuration is not permitted at the web.config level it has been placed at.
Re: Difficulty enabling health monitoring
Thanks, David. I'm still negotiating with the infrastructure team about getting access to the server, so when I do I'll look into the aspects you've described. :)