配置文件错误

陈绿清 2011-04-08 12:55:16
这个怎么表达呢,我用代码来表示吧,其中一个config.cn文件中的代码如下
static public Config ConfigSection
{
get
{
Config config = (Config)System.Configuration.ConfigurationManager.GetSection("setting");
if (config == null)
{
if (System.Web.HttpContext.Current == null)
throw new ApplicationException("The main forum control is not design-time compatible due to it's complexity. Please load the individual page controls to modify the forum.");
else
throw new ApplicationException("Failed to get configuration from Web.config.");
}
return config;
}
}
根据这个我去加载setting。config文件里面的内容,setting。config的内容如下:
<?xml version="1.0" encoding="utf-8"?>
<setting>
<version>奇盛贸易通 v1.0</version>
<system>WMB</system>
<connstr>Data Source=127.0.0.1;Initial Catalog=aaaaa;Integrated Security=True;timeout=90</connstr>
<!--ksn_taide KSN_WMB-->
<connstr2>user id=sa;pwd=xxxx;data source=xxxxx,xxx;initial catalog=bbbbb;timeout=90</connstr2>
<DataName>KSN_WMB</DataName>
<shotcuts>style\images\shotcuts</shotcuts>
<webdisk_dir>webdisk</webdisk_dir>
<webdisk_extlimit>txt,jpg,gif,pdf,doc,rar,xls,zip,swf,ppt</webdisk_extlimit>
<mail_programdir>/mail/</mail_programdir>
<workflow_type_payapp>1</workflow_type_payapp>
<workflow_system_salesorder_check>110</workflow_system_salesorder_check>
<chsspell>珑|L</chsspell>
<CONTROL_SERVER>http://192.168.1.110:300</CONTROL_SERVER>
<APP_ROOT_PATH>http://192.168.1.110:409</APP_ROOT_PATH>
</setting>
之前发布的版本读取的时候是没有问题的,可是目前我编译好后,挂载到IIS上总归会出现“无法将类型为“System.Int32”的对象强制转换为类型“KSN.DBUtility.Config”。
”的错误,错误代码就是 Config config = (Config)System.Configuration.ConfigurationManager.GetSection("setting");
这句话,谁能给出个解决方法,在线求答案
...全文
126 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
陈绿清 2011-04-08
  • 打赏
  • 举报
回复
这个我不清楚。断点也进不去,反正错误提示就是说他是INT类型的
静_心 2011-04-08
  • 打赏
  • 举报
回复
System.Configuration.ConfigurationManager.GetSection("setting");
返回的是INT类型?

62,072

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧