草庐IT

config-persistence

全部标签

c# - 在运行时更新 app.config system.net 设置

我需要在运行时更新.Netexeapp.config文件的system.netSectionGroup中的设置。我在运行时没有对原始配置文件的写入权限(我正在开发一个.Netdll加载项,它托管在我无法控制的应用程序提供的exe中)所以我希望保存一个副本文件并在运行时用修改后的版本替换exe中的配置。我试过以下但它不工作。有什么建议吗?Configurationconfig=ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);NetSectionGroupnetSectionGroup=confi

c# - 如何在 app.config 中添加换行符?

我不知道如何在由两行或更多行组成的app.config中编写消息。我通常在配置文件中的代码是:addkey="msg_test"value="Thisistestmessage."我用C锐利的代码读了它,例如:ConfigurationSettings.AppSettings[msg_test];我想写类似的东西addkey="msg_test"value="Thisistestmessage\nareyousureyouwanttocontinue?" 最佳答案 您可以只在值中使用换行符:addkey="msg_test"valu

c# - 如何在 app.config 中添加换行符?

我不知道如何在由两行或更多行组成的app.config中编写消息。我通常在配置文件中的代码是:addkey="msg_test"value="Thisistestmessage."我用C锐利的代码读了它,例如:ConfigurationSettings.AppSettings[msg_test];我想写类似的东西addkey="msg_test"value="Thisistestmessage\nareyousureyouwanttocontinue?" 最佳答案 您可以只在值中使用换行符:addkey="msg_test"valu

c# - 动态更改 app.config 文件中的值

我想修改app.config中appSetting部分的值。所以我写道,Console.WriteLine(ConfigurationManager.AppSettings["name"]);Console.Read();Configurationconfig=ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);config.AppSettings.Settings["name"].Value="raja";config.Save(ConfigurationSaveMode.Modified);C

c# - 动态更改 app.config 文件中的值

我想修改app.config中appSetting部分的值。所以我写道,Console.WriteLine(ConfigurationManager.AppSettings["name"]);Console.Read();Configurationconfig=ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);config.AppSettings.Settings["name"].Value="raja";config.Save(ConfigurationSaveMode.Modified);C

c# - 如何在运行时修改我的 App.exe.config key ?

在我的app.config中我有这个部分//severalothers通常我使用userId=ConfigurationManager.AppSettings["UserId"]访问这些值如果我使用ConfigurationManager.AppSettings["UserId"]=something修改它,该值不会保存到文件中,下次我加载应用程序时,它会使用旧值。如何在运行时更改某些app.config键的值? 最佳答案 System.Configuration.Configurationconfig=ConfigurationM

c# - 如何在运行时修改我的 App.exe.config key ?

在我的app.config中我有这个部分//severalothers通常我使用userId=ConfigurationManager.AppSettings["UserId"]访问这些值如果我使用ConfigurationManager.AppSettings["UserId"]=something修改它,该值不会保存到文件中,下次我加载应用程序时,它会使用旧值。如何在运行时更改某些app.config键的值? 最佳答案 System.Configuration.Configurationconfig=ConfigurationM

seata can not get cluster name in registry config ‘service.vgroupMapping.XXX‘

在学习seata的时候,很突然的就遇到这个问题。在seata官网解释说是事务分组和集群对应的关系,需要在client端配置。我使用nacos来做配置中心在红框标注的内容里,第三行的无序列表就说明了会用service.vgroupMapping.事务分组名去配置中心找TC的集群名称。所以只需要在nacos的配置中心中加上Data-Id为service.vgroupMapping.事务分组名,值设置为default有一个深坑,别看文档上写在applicaiton.properties上配置了service.vgroupMapping,其实是无效的。只有config.type=file才有效贴上上面

解决Pycharm运行服务器文件时出现Cannot find remote credentials for target config com.jetbrains.plugins.remotesdk.

解决Pycharm运行服务器文件时出现Cannotfindremotecredentialsfortargetconfigcom.jetbrains.plugins.remotesdk.target.webDeployment.WebDeploymentTargetEnvironmentConfiguration@1cb1d48解决Pycharm运行服务器文件时出现/usr/bin/python3:can’topenfile‘/root/xxx.py’:[Errno2]Nosuchfileordirectory错误类似下面这样解决方法取消勾选仅对此项目可见并设置py文件在服务器上的正确路径设置

c# - 在源代码文件中使用来自 web.config 的连接字符串

我知道这可能是一个非常基本的问题,但也许这就是我找不到答案的原因。现在,我正在通过执行以下操作在我的源文件中创建数据库连接:SqlConnectioncon=newSqlConnection("DataSource=...Password=...);SqlCommandcmd=newSqlCommand(String.Format("SELECT*FROMTable;"),con);con.Open();SqlDataReaderreader=cmd.ExecuteReader();但这意味着如果我选择更改数据库,那将是一个很大的痛苦。你们知道如何改用web.config文件中的连接字