你如何重新修改,当一个应用程序/重读app.config文件(.NET)? [英] How do you restart an app/reread app.config file when modified (.NET)?

查看:121
本文介绍了你如何重新修改,当一个应用程序/重读app.config文件(.NET)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们都知道,修改.NET Web应用程序的web.config文件重新启动应用程序,使得它读取更新的配置。你怎么做到这一点的一个控制台或WinForms应用程序?感谢:)

We all know that modifying a .NET web application's web.config file restarts the app and makes it read the updated configuration. How do you do that with a console or WinForms app? Thanks :)

推荐答案

可能需要一个FileSystemWatcher的被监视的文件,并处理相关事件。 该System.Configuration.ConfigManager类可能有相关的方法来重新加载(方法调用或类似)。我没有VS在我面前,但我会说有一些肯定有钩子肯定。

Probably need a FileSystemWatcher to monitor the file, and handle the relevant event. The System.Configuration.ConfigManager class might have the relevant methods to reload (method call or some such). I don't have VS in front of me, but I'd say there's definately some hooks there for sure.

这篇关于你如何重新修改,当一个应用程序/重读app.config文件(.NET)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆