Inhalte aufrufen

Profilbild

Connection string problems

Connection string Settings.txt

  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
2 Antworten zu diesem Thema

#1 JohnTBell

JohnTBell

    Newbie

  • Members
  • Punkt
  • 3 Beiträge

Geschrieben: 02 January 2018 - 13:36

Hi, 

 

I am having a similar problem in terms of what I have seen on the internet when I have googled this problem.  However, the DataSettings.cs looks like it has changed and wants you to store the Settings.txt in the Tenants folder in the App_Data.  I have tried different things and I cannot get my application to work.  I keep on getting the following error when I write update-database in the Package Manager Console.

 

A connection string could not be resolved for the parameterless constructor of the derived DbContext. Either the database is not installed, or the file 'Settings.txt' does not exist or contains invalid content.

 

My connection string looks like the following.

 

<connectionStrings>

<add name="ObjectContextBase" connectionString="Data Source=DESKTOP-FTT7V1S;Initial Catalog=SmartStoreNET5;Integrated Security=True" providerName="System.Data.SqlClient" />

</connectionStrings>

 

In the \src\Presentation\SmartStore.Web\App_Data\Tenants folder, I wrote the connection string like the following in the Settings.txt.

 

<add name="ObjectContextBase" connectionString="Data Source=DESKTOP-FTT7V1S;Initial Catalog=SmartStoreNET5;Integrated Security=True" providerName="System.Data.SqlClient" />

 
 
I left the following out of the Settings.txt obviously.  I have tried writing it many different ways and I am still getting the same error.
 
<connectionStrings>
</connectionStrings>

 

 

My email is j8.bell@gmail.com

 

Thanks,

 

John


  • Lighthouse gefällt das

#2 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 02 January 2018 - 14:25

Remove connection string(s) from web.config and enter it in \App_Data\Tenants\Default\Settings.txt. The whole content of Settings.txt looks like
AppVersion: 3.0.3.0
DataProvider: sqlserver
DataConnectionString: Data Source=<My SQL server>;Initial Catalog=<My database name>;Integrated Security=False;Persist Security Info=False;User ID=<My user name>;Password=<My password>;Enlist=False

PS: The file is created automatically during an installation, i. e. manual editing is actually not necessary.


  • Lighthouse gefällt das

Marcus Gesing

Smartstore AG


#3 JohnTBell

JohnTBell

    Newbie

  • Members
  • Punkt
  • 3 Beiträge

Geschrieben: 02 January 2018 - 16:59

Thank you!  I really appreciate your help.  The application is working now.