Is it possible to programmatically monitor C # health monitoring without using the web.config file?

I developed my own customer for health monitoring; however, I use the parameters in the constructor, and this is not allowed when using health monitoring from the web.config file.

Does anyone know if I can turn on / off the monitoring and check it correctly using the code (possibly in my global.asax file when the application starts).

Or, is it possible to create your own observer that will do the same as the health monitor.

Or finally, can I just pass the variables from the web.config setting (I am not familiar with the public token part of the provider type declaration).

Thanks in advance

+4
source share
1 answer

I don’t know if there are any other ideas ... after a lot of reading and trying, I ended up using parameters in the provider to pass information to the user bufferwebeventprovider.

If you create a custom provider and enable the Initialize (name, config) override method, then all of your parameters from your web.config file will go through the configuration parameter of the Initialize command. Then, in the initialize command, you can pull them out one by one (and delete them) before passing the rest of the config property to base.Initialize.

I used this to save and delete connection string information, timeouts, user identifiers, etc.

Anyway, I would still like to monitor performance monitoring, not having all the information in web.config (mainly because it is a website with several databases and several different settings). I will probably end up running the procedure in the user provider to check the settings and only record entries as needed based on all user settings.

Any other thoughts are very welcome !!

+1
source

Source: https://habr.com/ru/post/1307006/


All Articles