我有一些已部署的Windows窗体应用程序停止在特定计算机上运行。重新部署所有.exes和.dll的重新安装不会对解决错误产生任何影响。
在应用程序的第一次数据库访问中,错误如下:
Microsoft .NET Framework
Consulte o final desta mensagem para obter detalhes sobre como chamar a
depuração just-in-time (JIT) em vez desta caixa de diálogo.
************** Texto de Exceção **************
System.Data.SqlClient.SqlException (0x80131904): Erro de rede ou específico à instância ao estabelecer conexão com o SQL Server. O servidor não foi encontrado ou não estava acessível. Verifique se o nome da instância está correto e se o SQL Server está configurado para permitir conexões remotas. (provider: Named Pipes Provider, error: 40 - Não foi possível abrir uma conexão com o SQL Server) ---> System.ComponentModel.Win32Exception (0x80004005): O sistema não pode encontrar o arquivo especificado
em System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
em System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
em System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)
em System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
em System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
em System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
em System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions)
em System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
em System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
em System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions)
em System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions)
em System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
em System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
em System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
em System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
em System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
em System.Data.SqlClient.SqlConnection.Open()
em CodeFluent.Runtime.CodeFluentPersistence.OpenConnection()
em CodeFluent.Runtime.CodeFluentPersistence.InternalExecuteReader(CommandBehavior behavior, Boolean firstTry)
em CodeFluent.Runtime.CodeFluentPersistence.ExecuteReader(CommandBehavior behavior)
em CodeFluent.Runtime.CodeFluentPersistence.ExecuteReader()
我的app.config文件有一个
<configSections>
<section name="MyApp" type="CodeFluent.Runtime.CodeFluentConfigurationSectionHandler, CodeFluent.Runtime" />
</configSections>
然后是一个标签:
<MyApp persistenceTypeName="MySQL"
据我所知,这使得codefluent寻找MySql.Data而不是默认的System.Data(Sql Server)......
可能导致winforms应用程序在特定计算机上进行特定部署的原因是什么呢?
错误堆栈跟踪的关键点是:
em System.Data.SqlClient.SqlConnection.Open()
em CodeFluent.Runtime.CodeFluentPersistence.OpenConnection()
OpenConnection转换为System.Data,而不是MySql ....
我应该检查本机的Windows 7操作系统是否会导致这种奇怪的行为,而不是其他具有相同应用程序的Windows 7操作系统正常工作?