2017-02-13 12 views
0
<connectionStrings> 
    <add name="CentralDb" connectionString= 
    "metadata=.\CentralDb.csdl|.\CentralDb.ssdl|.\CentralDb.msl; 
     provider=System.Data.SqlClient; 
     provider connection string=CentralDb&quot;Data Source=U19675709\SQLEXPRESS&quot;Initial Catalog=CentralDb&quot;Integrated Security=True;MultipleActiveResultSets=False&quot;" 
     providerName="System.Data.EntityClient" /> 
      <add name="DefaultConnection" connectionString= 
    "metadata=.\CentralDb.csdl|.\CentralDb.ssdl|.\CentralDb.msl; 
     provider=System.Data.SqlClient; 
     provider connection string=CentralDb&quot;Data Source=U19675709\SQLEXPRESS&quot;Initial Catalog=CentralDb&quot;Integrated Security=True;MultipleActiveResultSets=False&quot;" 
     providerName="System.Data.EntityClient" /> 

    </connectionStrings> 
    <entityFramework> 
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> 
    <providers> 
     <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> 
    </providers> 
    </entityFramework> 

データベースを利用するEntityFrameworkの接続文字列を作成しようとしています。初期化文字列の初期化文字列の書式がインデックス227から始まる仕様に準拠していません

フォーマットは、インデックス227

から始まる仕様に準拠していません...私の上記web.configファイルで

答えて

1
を実行しようとしたとき、私は受信エラーです

接続文字列にDataSourceの説明の中に余分な引用符(&quot)があり、その直前にprovider connection stringの先頭に余分なCentralDbがあるようです。

代わりにこれを試してみてください:

<add name="CentralDb" connectionString= 
"metadata=.\CentralDb.csdl|.\CentralDb.ssdl|.\CentralDb.msl; 
    provider=System.Data.SqlClient; 
    provider connection string=&quot;Data Source=U19675709\SQLEXPRESS;Initial Catalog=CentralDb;Integrated Security=True;MultipleActiveResultSets=False&quot;" 
    providerName="System.Data.EntityClient" /> 
関連する問題