How to transfer website database to a new server on a new pc.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
2 Jahre weitere
Hi.

I want to transfer my website to another PC. I did copy the files and installed the SQL backup on the new SQL server but I get an error when I open the website on the new PC.

"An error occurred while starting the application.
SqlException: 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: 26 - Error Locating Server/Instance Specified)
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, object providerInfo, string newPassword, SecureString newSecurePassword, bool redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, bool applyTransientFaultHandling, string accessToken)
DependencyResolutionException: An exception was thrown while activating λ:Nop.Core.Domain.Common.CommonSettings.
Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action<ResolveRequestContext> next)
SqlException: 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: 26 - Error Locating Server/Instance Specified)"

I think that I need to edit the connection string in the DataSettings.cs but I don't know how to do that. I use nopCommerce version 4.40.4 can anyone help me?
2 Jahre weitere
Hi

On this file you can change your connection strings
App_Data>dataSettings.json

{
  "DataProvider": "sqlserver",
  "DataConnectionString": "Data Source=[YOUR SERVER NAME];Initial Catalog=[YOUR DATA BASE NAME];Integrated Security=False;Persist Security Info=False;User ID=[YOUR DATA BASE ID];Password=[YOUR DATA BASE PASSOWRD]",
  "RawDataSettings": {}
}

on above text need to replace
YOUR SERVER NAME
YOUR DATA BASE NAME
YOUR DATA BASE ID
YOUR DATA BASE PASSOWRD
2 Jahre weitere
Thank you for the fast reply it solved my problem. I have a second question but not about this topic. The question is how can I host my website files and database with a hosting provider?
2 Jahre weitere
Hi,

Hosting provider have FTP.You can get FTP details than upload all files and database. Connect your code with db via connection string.

That's set...!!

Thanks,
smiten
2 Jahre weitere
Do all hosting providers have FTP and can you host your website without a hosting provider?
2 Jahre weitere
All hosting providers have ftp.
Before deploying nopcommerce to a server (hosting provider) make sure you understand the process by experimenting with simple html pages.
2 Jahre weitere
how can i experiment?
2 Jahre weitere
RE: "host your website without a hosting provider?"
You can run nopCommerce locally for testing.  Although possible to self-host a public site, it's not recommended.  You would need a publicly accessible IP address, so you'd have to adjust your router and use some type of dyndns address, and you would have to keep your computer up 24/7.  Also, if you're not using either SQL Server Express or MySQL, then regular SQL Server would require purchasing a license from MS.  Hosting providers include SQL Server.

RE: "experiment"
SmarterASP.net has a one-click installer for nopCommerce.  For 4.40, you would need at least their Premium.NET plan which has 512 MB RAM.  So, you won't be able to do a 60 days free trial, but you can get paid hosting plan that has 60 Days money back guarantee.

After you install/test with the 1-click installer (I recommend you install sample DB), then you can upload/restore your DB, and adjust the \App_Data\dataSettings.json to point to the new DB.   Their control panel has a file explorer, and also you can use SSMS or other local SQL tool to connect directly to the database.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.