用C#編寫了一個Windows服務,並通過installutil安裝它。現在,當我試圖啓動服務,它說 "Service cannot be started. System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'Domain\MachineName$'.at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() 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.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlIn...
用戶在Windows服務中登錄失敗
雖然,測試但應用程序工作正常,但不知道錯誤給予。
請幫忙。
看來你的服務無法創建連接檢查你的連接字符串在app.config文件中 –
用戶名/密碼不匹配或服務器名稱不正確。打開你的數據庫,並檢查你是否使用(本地)/(。SQLExpress)或任何實例,並在連接字符串數據源中指定它 – Sakthivel