草庐IT

temp-config

全部标签

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文件中的连接字

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

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

c# - web.config中如何判断是否编译调试="true"

我在这里为应该简单的东西画了一个空白......我正在尝试做类似的事情:"/> 最佳答案 HttpContext.IsDebuggingEnabledproperty:usingSystem.Web;if(HttpContext.Current.IsDebuggingEnabled){/*...*/}来自文档:GetsavalueindicatingwhetherthecurrentHTTPrequestisindebugmode[…]trueiftherequestisindebugmode;otherwise,false.

c# - web.config中如何判断是否编译调试="true"

我在这里为应该简单的东西画了一个空白......我正在尝试做类似的事情:"/> 最佳答案 HttpContext.IsDebuggingEnabledproperty:usingSystem.Web;if(HttpContext.Current.IsDebuggingEnabled){/*...*/}来自文档:GetsavalueindicatingwhetherthecurrentHTTPrequestisindebugmode[…]trueiftherequestisindebugmode;otherwise,false.

c# - 在 app.config 中使用 XML 包含或配置引用来包含其他配置文件的设置

我的app.config中有标准的日志记录、NHibernate等配置block,我想将它们提取到一个通用的XML文件中,该文件可以作为我所有的引用应用程序的app.config文件。这可能吗? 最佳答案 是的,您可以使用configSource配置block的属性。所有配置block都有此属性-虽然没有记录。参见thisarticle,一直在底部,附录B。我还在下面粘贴了相关部分:AppendixB:includingexternalconfigurationfilesDespiteallthegreatnesstobefound