首页上一页 1 下一页尾页 5 条记录 1/1页
修改服务器
发表在ASP.NET图书答疑
2012-05-23
是否精华
是
否
版块置顶:
是
否
在IIS中调试发现的问题:
“/ GL”应用程序中的服务器错误。
关键“的AttachDbFilename'的值无效。
说明:执行当前Web请求期间,出现未处理的异常。请检讨有关错误的更多信息,堆栈跟踪,它起源于代码。 异常详细信息: System.ArgumentException:无效的关键“的AttachDbFilename”值。源错误:
Line 20:
Line 21: string strsql = "select * from aboutme";
Line 22: SqlConnection ll = new SqlConnection(ConfigurationManager.ConnectionStrings["ConStr"].ToString());
Line 23: ll.Open();
Line 24: SqlDataAdapter da = new SqlDataAdapter(strsql, ll);
源文件: c:\Inetpub\wwwroot\gl\index.aspx.cs 行: 22 堆栈跟踪:
[ArgumentException: Invalid value for key 'attachdbfilename'.]
System.Data.SqlClient.SqlConnectionString.VerifyLocalHostAndFixup(String& host, Boolean enforceLocalHost, Boolean fixup) +903550
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +4116
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +150
System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +59
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
System.Data.SqlClient.SqlConnection..ctor(String connectionString) +26
index.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\gl\index.aspx.cs:22
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
怀疑是这个出问题,因为在vs2008能运行。怎么修改
<add name="ConStr" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\db_SIS.mdf;Integrated Security=True;User Instance=True"
这句
“/ GL”应用程序中的服务器错误。
关键“的AttachDbFilename'的值无效。
说明:执行当前Web请求期间,出现未处理的异常。请检讨有关错误的更多信息,堆栈跟踪,它起源于代码。 异常详细信息: System.ArgumentException:无效的关键“的AttachDbFilename”值。源错误:
Line 20:
Line 21: string strsql = "select * from aboutme";
Line 22: SqlConnection ll = new SqlConnection(ConfigurationManager.ConnectionStrings["ConStr"].ToString());
Line 23: ll.Open();
Line 24: SqlDataAdapter da = new SqlDataAdapter(strsql, ll);
源文件: c:\Inetpub\wwwroot\gl\index.aspx.cs 行: 22 堆栈跟踪:
[ArgumentException: Invalid value for key 'attachdbfilename'.]
System.Data.SqlClient.SqlConnectionString.VerifyLocalHostAndFixup(String& host, Boolean enforceLocalHost, Boolean fixup) +903550
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +4116
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +150
System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +59
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
System.Data.SqlClient.SqlConnection..ctor(String connectionString) +26
index.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\gl\index.aspx.cs:22
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
怀疑是这个出问题,因为在vs2008能运行。怎么修改
<add name="ConStr" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\db_SIS.mdf;Integrated Security=True;User Instance=True"
这句