ASP.NETWebサイトで次のエラーが発生します。別のPCに移動しました。IISを実行し、SQL Server Expressを実行し、データソースのマシン名を新しいマシン名に変更しました。ただし、DBアクセスのあるページでは、スクリーンショットに示すエラーが発生します。
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();
}
これをデバッグするための最良の方法に関するアドバイスはありますか?または、おそらくあなたも何が悪いのか知っていますか?!
ありがとう、