【发布时间】:2012-05-20 07:07:47
【问题描述】:
我的 ASP.NET 网站出现以下错误。我刚把它移到另一台电脑上。运行 IIS,SQL Server Express 并将数据源机器名称更改为新机器名称。但是,在任何具有数据库访问权限的页面上,我都会收到屏幕截图中显示的错误:
innovations-news.aspx 这样创建了一个新的 DataContext:
dataContext = new DataContext(Config.ConnectionString);
My Config 类根据当前 IP 返回连接字符串。例如:
return ConfigurationManager.ConnectionStrings["Development"].ConnectionString;
在 web.config 中:
<connectionStrings>
<add name="Development" connectionString="Data Source=WORK51C0\SQLEXPRESS;Initial Catalog=Jri;Integrated Security=True;" providerName="System.Data.SqlClient"/>
</connectionStrings>
以下来自LinqToSql1.designer.cs
public DataContext() :
base(global::Jri.Data.Properties.Settings.Default.JriConnectionString1, mappingSource)
{
OnCreated();
}
public DataContext(string connection) :
base(connection, mappingSource)
{
OnCreated();
}
public DataContext(System.Data.IDbConnection connection) :
base(connection, mappingSource)
{
OnCreated();
}
public DataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
public DataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
关于如何最好地调试它有什么建议吗?或者,也许你也知道出了什么问题?!
谢谢,
【问题讨论】:
-
WORK51C0 是新工作站的名称吗?它是否具有具有该实例名称的 SQL Express,并且是否已打开集成安全性?可以连接 Sql Server Management Studio 吗?
-
是
connection还是mappingSource为空? -
您的 Jri.Data.DataContact 是否派生自 Linq.DataContext?我们可以使用更多信息...
-
好吧,我在 Windows 7 家庭版上,我刚刚发现它不支持 Windows 身份验证。我能做些什么呢?
-
刚刚更新了来自 LinqToSql1.designer.cs 的 DataContext 函数
标签: c# asp.net sql-server iis