0

I have some deployed windows forms applications that stopped working on a specific machine. A fresh reinstall redeploying all .exes and .dlls have no effect on resolving the error.

On the very first database access on the application, the error is such as:

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()

My app.config file has a

<configSections>
      <section name="MyApp" type="CodeFluent.Runtime.CodeFluentConfigurationSectionHandler, CodeFluent.Runtime" />
    </configSections>

and then a tag like:

 <MyApp persistenceTypeName="MySQL"

I understand that this makes codefluent look for MySql.Data instead of the default System.Data (Sql Server)...

What may be causing this specific deployment of the winforms application on a specific machine, to be overriding that?

The key point on the error stack trace is:

   em System.Data.SqlClient.SqlConnection.Open()
   em CodeFluent.Runtime.CodeFluentPersistence.OpenConnection()

OpenConnection transitions to System.Data, instead of MySql....

What should I check on the Windows 7 OS of this machine that could cause such strange behavior, as opposed to other Windows 7 OS with the same application working just fine?

Renato Xavier
  • 123
  • 1
  • 9
  • Are you sure "MyApp" matches exactly the value of the string constant named [default namespace]StoreName field declared in the Constants class in the _cf_rt.cs generated file? – Simon Mourier Jan 11 '16 at 15:31
  • Yes I am sure, @SimonMourier, I double checked. Anyway, in VS2013 the project runs fine, after deployment the application also runs fine except on this machine as I have reported. Could this be the case of reinstalling .NET Framework, or some other issue related to Windows 7, any restriction or incompatibility? – Renato Xavier Jan 11 '16 at 16:41
  • 1
    i doubt it. Unless you play heavy tricks with some CodeFluent Runtime classes, or use threads, etc., by default, it uses what's in the .config file. If it doesn't use the persistenceTypeName, it's because the .config is not what you think, or simply non existent. Even if MySQL driver was not installed, you would have another problem. – Simon Mourier Jan 11 '16 at 16:53

0 Answers0