你的Config应该有点问题
给你一个例子
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="ApplicationConfiguration" type="Duwamish7.SystemFramework.ApplicationConfiguration, Duwamish7.SystemFramework" />
<section name="DuwamishConfiguration" type="Duwamish7.Common.DuwamishConfiguration, Duwamish7.Common" />
<section name="SourceViewer" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<system.web>
<customErrors defaultRedirect="errorpage.aspx" mode="On" />
<compilation debug="true" />
<!-- The sessionState is currently set to inproc: the lines following [mode="inproc"] are not used but are present for ease of configuration -->
<sessionState cookieless="false" timeout="20" mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa;password=" />
<globalization responseEncoding="utf-8" requestEncoding="utf-8" />
<!-- security -->
<authentication mode="Forms">
<forms name=".ADUAUTH" loginUrl="secure\logon.aspx" protection="All">
</forms>
</authentication>
<authorization>
<allow users="*" />
</authorization>
</system.web>
<ApplicationConfiguration>
<!-- Trace file settings -->
<add key="SystemFramework.Tracing.Enabled" value="False" />
<!-- Set this to the file with the trace settings. This file should be relative
to the root application directory. -->
<add key="SystemFramework.Tracing.TraceFile" value="DuwamishTrace.txt" />
<!-- The TraceLevel for this switch. -->
<add key="SystemFramework.Tracing.TraceLevel" value="4" />
<!-- This switch name. The trace level for this name can be set through
environment variables or the registry -->
<add key="SystemFramework.Tracing.SwitchName" value="DuwamishTraceSwitch" />
<!-- This description of the Tracing.SwitchName switch -->
<add key="SystemFramework.Tracing.SwitchDescription" value="Error and information tracing for Duwamish" />
<!-- Event log settings
Note: The default Duwamish7 event source name is created in the local machine during setup. If you wish to log events to a different event source
that event source must exist.
-->
<add key="SystemFramework.EventLog.Enabled" value="True" />
<add key="SystemFramework.EventLog.Machine" value="." />
<add key="SystemFramework.EventLog.SourceName" value="Duwamish7" />
<!-- Use the standard TraceLevel values:
0 = Off
1 = Error
2 = Warning
3 = Info
4 = Verbose -->
<add key="SystemFramework.EventLog.LogLevel" value="1" />
</ApplicationConfiguration>
<DuwamishConfiguration>
<!-- Settings specific to the Duwamish application -->
<add key="Duwamish.DataAccess.ConnectionString" value="server=DRAGONTT;User ID=Duwamish7_login;Password=password;database=Duwamish7;Connection Reset=FALSE" />
<add key="Duwamish.Web.EnablePageCache" value="True" />
<add key="Duwamish.Web.PageCacheExpiresInSeconds" value="3600" />
<add key="Duwamish.Web.EnableSsl" value="False" />
</DuwamishConfiguration>
<SourceViewer>
<!-- Valid directories for source browsing. Keep these lower case. -->
<add key="." value=" " />
<add key="modules" value=" " />
<add key="..\common\data" value=" " />
<add key="..\systemframework" value=" " />
<add key="..\business\facade" value=" " />
<add key="..\business\rules" value=" " />
<add key="..\dataaccess" value=" " />
<add key="secure" value=" " />
<add key="docs\common" value=" " />
<add key="docs\dataaccess" value=" " />
<add key="docs\facade" value=" " />
<add key="docs\rules" value=" " />
<add key="docs\web" value=" " />
</SourceViewer>
</configuration>
给你一个例子
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="ApplicationConfiguration" type="Duwamish7.SystemFramework.ApplicationConfiguration, Duwamish7.SystemFramework" />
<section name="DuwamishConfiguration" type="Duwamish7.Common.DuwamishConfiguration, Duwamish7.Common" />
<section name="SourceViewer" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<system.web>
<customErrors defaultRedirect="errorpage.aspx" mode="On" />
<compilation debug="true" />
<!-- The sessionState is currently set to inproc: the lines following [mode="inproc"] are not used but are present for ease of configuration -->
<sessionState cookieless="false" timeout="20" mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa;password=" />
<globalization responseEncoding="utf-8" requestEncoding="utf-8" />
<!-- security -->
<authentication mode="Forms">
<forms name=".ADUAUTH" loginUrl="secure\logon.aspx" protection="All">
</forms>
</authentication>
<authorization>
<allow users="*" />
</authorization>
</system.web>
<ApplicationConfiguration>
<!-- Trace file settings -->
<add key="SystemFramework.Tracing.Enabled" value="False" />
<!-- Set this to the file with the trace settings. This file should be relative
to the root application directory. -->
<add key="SystemFramework.Tracing.TraceFile" value="DuwamishTrace.txt" />
<!-- The TraceLevel for this switch. -->
<add key="SystemFramework.Tracing.TraceLevel" value="4" />
<!-- This switch name. The trace level for this name can be set through
environment variables or the registry -->
<add key="SystemFramework.Tracing.SwitchName" value="DuwamishTraceSwitch" />
<!-- This description of the Tracing.SwitchName switch -->
<add key="SystemFramework.Tracing.SwitchDescription" value="Error and information tracing for Duwamish" />
<!-- Event log settings
Note: The default Duwamish7 event source name is created in the local machine during setup. If you wish to log events to a different event source
that event source must exist.
-->
<add key="SystemFramework.EventLog.Enabled" value="True" />
<add key="SystemFramework.EventLog.Machine" value="." />
<add key="SystemFramework.EventLog.SourceName" value="Duwamish7" />
<!-- Use the standard TraceLevel values:
0 = Off
1 = Error
2 = Warning
3 = Info
4 = Verbose -->
<add key="SystemFramework.EventLog.LogLevel" value="1" />
</ApplicationConfiguration>
<DuwamishConfiguration>
<!-- Settings specific to the Duwamish application -->
<add key="Duwamish.DataAccess.ConnectionString" value="server=DRAGONTT;User ID=Duwamish7_login;Password=password;database=Duwamish7;Connection Reset=FALSE" />
<add key="Duwamish.Web.EnablePageCache" value="True" />
<add key="Duwamish.Web.PageCacheExpiresInSeconds" value="3600" />
<add key="Duwamish.Web.EnableSsl" value="False" />
</DuwamishConfiguration>
<SourceViewer>
<!-- Valid directories for source browsing. Keep these lower case. -->
<add key="." value=" " />
<add key="modules" value=" " />
<add key="..\common\data" value=" " />
<add key="..\systemframework" value=" " />
<add key="..\business\facade" value=" " />
<add key="..\business\rules" value=" " />
<add key="..\dataaccess" value=" " />
<add key="secure" value=" " />
<add key="docs\common" value=" " />
<add key="docs\dataaccess" value=" " />
<add key="docs\facade" value=" " />
<add key="docs\rules" value=" " />
<add key="docs\web" value=" " />
</SourceViewer>
</configuration>
解决方案 »
- html中有几张图片,点击之后都跳到另一个页面,怎么在这个页面获取刚才图片页里面的值和对象
- asp.net怎么与控件传值
- 在 asp.net 后台代码中怎样实现弹出一个确认对话框,就像 Html 中的 alert("message") 输出message 但是弹出对话框页面中的内容也显示,而
- 请问怎样在网页中调用ActiveX的打印功能?
- asp.net使用多线程处理队列,并保证线程持续执行???
- 这个问题对我来说有点难?初学者一起学习,高手请指点迷津!
- 刚学 asp.net 便搞不下去了——我怎么就不能debug呢?
- 想弄一个互相发消息的那种怎么搞呀~~急死人了~~
- membership 配置 自定义表 问题
- 如何将一个表的主键(两个字段)合并在dataset的一个字段里??
- 高手请进,如何把word文档转换成html
- 在Asp.net中哪个控件有双击事件?如何在asp.net中编写?
后面的方括号应该是C#的用法,VB应该是圆括号,改成这样试试:
dim ConnectionString as string = ConfigurationSettings.AppSettings("myconnectionstring")
dim conn as SqlConnection=new SqlConnection(ConnectionString)
dim mysql as new sqlconnection(connectionstring)
...
mysql.open()的时候。可见connectionstring 在调用webconfig中没有获得字串。不知我的分析是否正确?
<add key="ConnString" value="data source=DATASRV;initial catalog=jsmis;password=jsmis;persist security info=True;user id=jsmis;workstation id=DATASRV;packet size=4096" />
</appSettings>
一定要放到<configuration>和<system.web>之间读取这个连接:
SqlCnStr = ConfigurationSettings.AppSettings("ConnString")