Log4Net fun database - connection strings!

This works on dev:

 <connectionString name="asdf" value="Data Source=.\;Initial Catalog=fmwebapp1;Integrated Security=True" />
      <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

In real time (64-bit VPS) this does not work:

<connectionString value="CT210991\SQLEXPRESS;Initial Catalog=fmwebapp1;Integrated Security=True" />
      <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

Error:

log4net:ERROR [AdoNetAppender] Could not open database connection [CT210991\SQLEXPRESS;Initial Catalog=fmwebapp1;Integrated Security=True]
System.ArgumentException: Keyword not supported: 'ct210991\sqlexpress;initial catalog'.
   at System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey)
   at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules)
   at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
   at System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value)
   at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
   at log4net.Appender.AdoNetAppender.InitializeDatabaseConnection()

brain is fuzzy .. 64-bit problem?

+3
source share
2 answers

You do not have "Data Source =" before "CT210991 \ SQLEXPRESS" in your connectionString value.

+3
source

You are missing the Data Source bit:

<connectionString value="Data Source=CT210991\SQLEXPRESS;Initial Catalog=fmwebapp1;Integrated Security=True" />
+2
source

Source: https://habr.com/ru/post/1760953/


All Articles