2016-04-25 21 views
0

webconfigに2つの接続文字列があります。Web.configの2つの文字列

<connectionStrings> 
    <add name="DataAccess_DynamicWebEntities" connectionString="metadata=res://*/DataAccess_DynamicWeb.csdl|res://*/DataAccess_DynamicWeb.ssdl|res://*/DataAccess_DynamicWeb.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=\SQLEXPRESS;initial catalog=Dynamicweb-Verploegen-Test_new;user id='VERPLOEGEN\Niels';password='';multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" /> 
    <add name="NAV2DWservice.Properties.Settings.NAVconnectionString" connectionString="Data Source=\SQLEXPRESS;Integrated Security=SSPI;Initial catalog=Verploegen-Test;"/> 
</connectionStrings> 

だから、上記のConnectionString作品が、doesntの仕事下記1:このような

はい、データベースベース名は正しいです。

はあなた

ありがとうこれはエラーです:

System.Data.EntityException: De onderliggende provider is mislukt op Open. ---> System.Data.SqlClient.SqlException: Login failed for user 'VERPLOEGEN\Niels'. 
    bij System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) 
    bij System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) 
    bij System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) 
    bij System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) 
    bij System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) 
    bij System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) 
    bij System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) 
    bij System.Data.SqlClient.SqlConnection.Open() 

はい、私はログインを持っています。私はこのようにそれを宣言すると、画像enter image description here

を参照してください。

 <add name="DataAccess_DynamicWebEntities" connectionString="Data Source=DESKTOP-UON3ACI\SQLEXPRESS;initial catalog=Dynamicweb-Verploegen-Test_new;Integrated Security=SSPI;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" /> 
     <add name="NAV2DWservice.Properties.Settings.NAVconnectionString" connectionString="Data Source=DESKTOP-UON3ACI\SQLEXPRESS;Integrated Security=SSPI;Initial catalog=Verploegen-Test;" /> 

I get this error: 

System.ArgumentException: Het sleutelwoord wordt niet ondersteund: data source. 
    bij System.Data.EntityClient.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Hashtable synonyms) 
    bij System.Data.EntityClient.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms) 
    bij System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) 
    bij System.Data.EntityClient.EntityConnection..ctor(String connectionString) 
    bij System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection) 

は、トリックをしていた:

答えて

1

資格情報が正しいことを確認してください。

Login failed for user 'VERPLOEGEN\Niels'

それは(例えばsaが、これらのうちの一つの例だろう、このログイン情報は、実際にあなたのSQL Serverインスタンスにログインするための資格情報であることを考慮することが重要です:あなたのエラーメッセージが明示的にデータベースにログインすると、失敗したと述べているとおり)、下図のように似て作成することができる:あなたは、現在のユーザーまたはドメインレベルのユーザーを使用する場合

enter image description here

そうでない場合は、接続文字列に次を追加してみてください:

Integrated Security=SSPI; 

か:

Integrated Security=true; 

あなたのローカルSQLインスタンスにアクセスしてみてください、あなたは、彼らが正しいことを確認するために使用される資格情報の中にログインしようすることをお勧めします。

+0

ご返信ありがとうございます。私は投稿を編集します – InfinityGoesAround

+0

他に何ができますか?ありがとうございます – InfinityGoesAround

+0

接続文字列から明示的にユーザー名とパスワードの資格情報を削除しようとしましたが、 'Integrated Security = true'を使用しましたか?別のユーザーを使用するか、ユーザー名のドメインセクション(「VERPLOEGEN \ Niels」ではなく「Niels」)を削除して、まったく認証できるかどうかを確認して現在のユーザーについて心配することもできます。 –

0

これは、アクセス許可の問題のように見えます。ユーザー 'VERPLOEGEN \ Niels'はデータベースにアクセスできません。

+0

コメントあります。 –

+0

ああ。申し訳ありません。 – mkerchenski

0

最初の接続文字列はSQLサーバーアカウントを使用してログインし、2番目の接続文字列はWindowsアカウントを使用します。ユーザー名とパスワードが同じであっても、SQL Serverとは異なるアカウントであり、両方に許可が必要です。また、SQL ServerアカウントとWindowsアカウントの両方を使用するには、SQL Serverが混合認証モードを使用するようにセットアップされている必要があります。

+1

ご意見ありがとうございます。はい、私は両方のデータベースのアクセス許可を与えています。そして、はい、私は混在した環境を持っています。最新の記事を見る – InfinityGoesAround

関連する問題