1

私は1つのリモートデータベースから別のデータベースにデータを転送するWindowsサービスを開発しています。ユーザー 'sa'のログインに失敗しました。理由:信頼できるSQLに関連付けられていません

データベースに接続しようとすると、次のエラーが発生します。この接続文字列は、Webアプリケーションから完璧に機能します。

Windowsサービスを使用してデータベースに接続しようとすると、このエラーが発生します。

System.Data.SqlClient.SqlException: Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection. 
    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) 
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) 
    at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) 
    at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) 
    at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) 
    at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) 
    at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) 
    at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) 
    at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) 
    at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) 
    at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) 
    at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) 
    at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) 
    at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) 
    at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) 
    at System.Data.SqlClient.SqlConnection.Open() 
    at WindowsService.Program.timer1_Elapsed(Object sender, EventArgs e) in E:\Trigger\WindowsService\WindowsService\Program.cs:line 93 

のConnectionString私が使用しています:

SqlConnection con = new SqlConnection("Data Source=TAG2;Initial Catalog=A10;User ID=sa; pwd=root;Integrated Security=False");" 

答えて

3

SQL Serverが最も可能性の高い "窓の真偽のみ" モードに設定されています。

エラーを解決するには、MSDN linkを参照してください。

0

データベースの設定をチェックしてみ - あなたはおそらく からの認証方法を変更する必要がある「Windowsのみ」「SQL認証」

へのデフォルトのインストールとしてhere

+0

私は同じモードでも、同じエラーが表示されます。 – user941105

関連する問題