是否可以在不使用 web.config 文件的情况下以编程方式控制 c# 运行状况监控?

发布于 2024-08-28 18:57:59 字数 263 浏览 2 评论 0原文

我开发了自己的健康监测定制提供商;但是,我在构造函数中使用参数,而在使用 web.config 文件中的运行状况监控时,这是不允许的。

有谁知道我是否可以打开/关闭监视并通过代码(可能在应用程序启动时在我的 global.asax 文件中)正确监视。

或者,我是否可以创建自己的观察程序,它可以执行与运行状况监视器相同的操作。

或者,最后 - 我可以只传递 web.config 设置中的变量吗(我不熟悉提供程序类型声明的公共令牌部分)。

提前致谢

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

Does anyone know if I can turn on/off the monitoring and have it watch properly through code (possibly in my global.asax file on application startup).

Or, is it possible for me to create my own watcher that will do the same thing as the health monitor.

Or, finally - can I just pass variables from the web.config setup (i'm not familiar with the public token part of the provider type declaration).

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

羅雙樹 2024-09-04 18:57:59

我不知道是否还有其他更好的想法...经过大量阅读和尝试后,我最终使用提供程序中的参数将信息传递到自定义 bufferedwebeventprovider 中。

如果您创建自定义提供程序并包含覆盖 Initialize(name, config) 方法,则 web.config 文件中的所有参数都将通过 Initialize 命令的配置参数传递。然后在初始化命令中,您可以将它们一一取出(并删除它们),然后将配置属性的其余部分传递给 base.Initialize 方法。

我用它来保存和取消连接字符串信息、超时、自定义 ID 等。

无论如何,我仍然想知道在没有 web.config 中的所有信息的情况下控制运行状况监控(主要是因为这是数据库驱动的)具有多个用户和多个不同设置的网站)。我最终可能会在自定义提供程序中使用一个程序来检查设置,并根据每个用户的设置仅根据需要记录条目。

任何其他想法都非常欢迎!

I don't know if there are any other better ideas out there... after a lot of reading and trying I ended up using parameters in the provider to pass information into a custom bufferedwebeventprovider.

If you create a custom provider and include the override Initialize(name, config) method then all of your parameters from your web.config file will come through the config param of the Initialize command. Then in the initialize command you can pull them off one by one (and remove them) before passing the rest of the config property to the base.Initialize method.

I used this to save and pull off connection string info, timeouts, custom id's, etc.

I would still like to know anyway to control the health monitoring without having all of the info in the web.config (mostly because this is a database driven website with multiple users and multiple different settings). I'll probably end up having a procedure within the custom provider to check settings and only record entries as needed based on each user's settings.

any other thoughts are very welcome!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文