我有2个应用程序:
控制实用程序的要求非常简单:
http://local:5555
)寻找一个名为“ MyService”的Windows服务,检索其状态并在需要时启动它非常简单。但是,如何使用正确的链接启动浏览器?HTTP侦听器正在侦听的端口可以在Windows服务应用程序的app.config中进行配置,并且没有发现侦听器的可能性。可以在2个应用程序之间共享app.config吗?
我知道ConfigurationManager
有OpenExeConfiguration()
,但这会引起其他问题:
还有其他解决方案吗?
您可以使用注册表交换数据。
// Create a Subkey
RegistryKey newKey = Registry.CurrentUser.CreateSubKey("SOFTWARE\\SuperSoft\\App");
// Write Values to the Subkey
newKey.SetValue("Value1", "Content1");
newKey.SetValue("Value2", "Content2");
// read Values from the Subkey
if (SubKeyExist("SOFTWARE\\SuperSoft\\App"))
{
RegistryKey myKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\SuperSoft\\App");
string firstApp = (string)myKey.GetValue("Value1");
string secondApp = (string)myKey.GetValue("Value2");
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句