2017-02-10 19 views
1

私のアプリケーションは、ライブラリXXX.Data内の接続文字列更新データベースがエラー0x80131904で失敗し

<connectionStrings> 
    <add name="XXX" connectionString="Data Source=(LocalDb)\v14.0;Initial Catalog=XXX;Integrated Security=SSPI; MultipleActiveResultSets=true" providerName="System.Data.SqlClient" /> 
    </connectionStrings> 

を持っている(サーバーが見つかりません)。コマンドupdate-databaseがPMCに開始されたときには、エラーが表示されます。

Target database is: 'XXX' (DataSource: .\SQLEXPRESS, Provider: System.Data.SqlClient, Origin: Convention). 
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) 
    at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling) 

それは.\SQLEXPRESS代わりの(LocalDb)\v14.0;Initial Catalog=XXXに接続しようと?どうして?

私はdllファイルに他のconnenction文字列を持っていません。

更新1: は、私は他の接続文字列を使用してみましたが、それはあまりにも失敗しました:私はEFを含むxxx.webプロジェクトをアンロードしなければならなかった

<connectionStrings> 
    <add name="XXX" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;Initial Catalog=XXX;Integrated Security=SSPI; MultipleActiveResultSets=true" providerName="System.Data.SqlClient" /> 
    </connectionStrings> 

答えて

1
  1. が、それは、接続文字列ではありませんでした。

    update-database -ConnectionStringName "XXX" -ProjectName "XXXX.Data" 
    

  • は、ステップ1の後、それは2つのパラメータを用いて、次のコマンドのために働い

  • 関連する問題