0

信頼できる接続文字列を使用してSQLServerExpressx64に接続するWinformを作成しました。

開発マシン(SQL Serverも実行されている)では、Winformは100%動作し、結果の接続文字列は次のようになります。

Persist Security Info=False;
Integrated Security=true;
Initial Catalog=BushBreaksLodgeManager;
server=.\SQLEXPRESS

ネットワークに接続されたPCで同じwinフォームを試してみると、接続に失敗します。リモートマシンでは、ネットワークの場所を介して開発マシンを見ることができます。\\JOHN-WIN7PC

リモートPCの結果の接続文字列は次のとおりです。

Persist Security Info=False;
Integrated Security=true;
Initial Catalog=BushBreaksLodgeManager;
server=\\JOHN-WIN7PC\SQLEXPRESS

また、SQL ServerでTCP-IPを有効にし(に設定されています<default>)、すべてのファイアウォールをオフにし、マルウェア対策(これが干渉するわけではありません)をオフにし、ウイルス対策がどちらのマシンにもインストールされていません。

SQL database settings are as follows:
==================================================
Authentication method: Windows Authentication
Database: BushBreaksLodgeManager
ServerName: JOHN-WIN7PC\SQLEXPRESS
Instancename: SQLEXPRESS
Computername: JOHN-WIN7PC

Sql Server settings
==================================================
Mixed mode (Win auth and Sql Server)
Connections -> Allow remote connections = true

私は途方に暮れているので、この点でどんな助けでもいただければ幸いです。

以下に例外を貼り付けました。

2011/11/18 04:55:50 PM : Process: UtilsDatabase -> TestDatabaseConnection
2011/11/18 04:56:05 PM : Process: UtilsDatabase -> TestDatabaseConnection Connection failed
2011/11/18 04:56:05 PM : Settings value -> UseIntergratedSecurity: False
2011/11/18 04:56:05 PM : Settings value -> Server: \\JOHN-WIN7PC\SQLEXPRESS
2011/11/18 04:56:05 PM : Settings value -> Database name: BushBreaksLodgeManager
2011/11/18 04:56:05 PM : Connection String: Persist Security Info=False;Integrated Security=true;Initial Catalog=BushBreaksLodgeManager;server=\\JOHN-WIN7PC\SQLEXPRESS

==================== New Exception ====================
2011/11/18 04:56:05 PM

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: 25 - Connection string is not valid)

.Net SqlClient Data Provider

   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject)
   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.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 BushBreaksLodgeManager.UtilsDatabase.TestDatabaseConnection()

Void OnError(System.Data.SqlClient.SqlException, Boolean)
4

1 に答える 1

0

エラーは非常に単純だと思います。SQL Serverに接続するときは、サーバー名の前に。を付けない\\ので、代わりにserver=\\JOHN-WIN7PC\SQLEXPRESSを使用する必要がありますserver=JOHN-WIN7PC\SQLEXPRESS

于 2012-02-05T04:17:14.607 に答える