Migrate from test to production

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 лет назад
Hi Guys,

I've built a test site on domain x.com with Nop4.1 and would like to know how to migrate to my production domain z.com. I've backup and restored to a new database and copied all the files from x.com to z.com. Changed the dataSettings.json DataConnectionString to point to the new database.

z.com returns

An error occurred while starting the application.
.NET Core 4.6.26814.03 X64 v4.0.0.0    |   Microsoft.AspNetCore.Hosting version 2.1.1-rtm-30846    |    Microsoft Windows 10.0.14393    |  

I'm on a shared hosting server at A2Hosting.

Anyone has some clear instructions of how to migrate a Nop4.1 installation?


Much appreciated

Jo
5 лет назад
Process looks ok. It might be a silly question but Has z.com been setup with Net.Core runtime etc as per
http://docs.nopcommerce.com/display/en/Installation+guide

When I do a new install on a new machine I always let it run though the install to make sure it all works. Then change the datasettings.json file to my database
5 лет назад
Hi Yidna, thanks for the quick reply. Both sites are on the same host/server, just a different folder. The test site x.com works fine. Not sure why z.com would require an additional Net.Core runtime.


I have done quite a bit of configuration and added plugins on the test site. I'm trying to avoid rebuilding this in the production site from scratch using a fresh install. Also prefer to test future enhancement in my test site before promoting to the live production site. Makes sense?
5 лет назад
kerkorrel wrote:
Both sites are on the same host/server
Ok Just checking - then system should be configured all good

kerkorrel wrote:
I'm trying to avoid rebuilding this in the production site from scratch using a fresh install
It's just something I do on the very first run to make sure everything else is ready to go. Then I edit setup files to point to production database.

kerkorrel wrote:
Also prefer to test future enhancement in my test site before promoting to the live production site. Makes sense?
Yes that's what I do - once I know the system is up and running (as above) and then I develop away in test and copy it to production when its ready to go live.

Maybe you have got it working now - if not then enable stdoutLogEnabled="true" in web.xml and check the error logs
4 года назад
Hi,

Did you ever solve this issue?

I ran into the same error trying to migrate from test site to production site.

Steps taken so far:
I've built a test site on domain x.com with Nop 4.1 and would like to know how to migrate to my production domain z.com.
I've backup and restored to a new database and copied all the files from x.com to z.com.
Changed the dataSettings.json DataConnectionString to point to the new database.

And I am seeing the below error:

An error occurred while starting the application.
.NET Core 4.6.27317.03 X64 v4.0.0.0    |   Microsoft.AspNetCore.Hosting version 2.1.1-rtm-30846    |    Microsoft Windows 6.2.9200    |
  
Kind regards,
Joe W
4 года назад
Further to the above:

I set stdoutLogEnabled="true" to view the error logs and I get the below error log:
Any ideas on how to fix this?

info: Microsoft.EntityFrameworkCore.Infrastructure[10403]
      Entity Framework Core 2.1.1-rtm-30846 initialized 'NopObjectContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: using lazy-loading proxies RowNumberPaging
info: Microsoft.EntityFrameworkCore.Database.Command[20101]
      Executed DbCommand (39ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
      SELECT [t].[Id], [t].[Enabled], [t].[LastEndUtc], [t].[LastStartUtc], [t].[LastSuccessUtc], [t].[Name], [t].[Seconds], [t].[StopOnError], [t].[Type]
      FROM [ScheduleTask] AS [t]
      WHERE [t].[Enabled] = 1
      ORDER BY [t].[Seconds] DESC
info: Microsoft.EntityFrameworkCore.Database.Command[20101]
      Executed DbCommand (3ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
      SELECT [s].[Id], [s].[CompanyAddress], [s].[CompanyName], [s].[CompanyPhoneNumber], [s].[CompanyVat], [s].[DefaultLanguageId], [s].[DisplayOrder], [s].[Hosts], [s].[Name], [s].[SslEnabled], [s].[Url]
      FROM [Store] AS [s]
      ORDER BY [s].[DisplayOrder], [s].[Id]
info: Microsoft.EntityFrameworkCore.Database.Command[20101]
      Executed DbCommand (1ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
      SELECT [s].[Id], [s].[Name], [s].[StoreId], [s].[Value]
      FROM [Setting] AS [s]
      ORDER BY [s].[Name], [s].[StoreId]
fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
      Failed executing DbCommand (55ms) [Parameters=[@p0='?' (DbType = DateTime2), @p1='?' (DbType = Int32), @p2='?' (Size = 4000), @p3='?' (Size = 200), @p4='?' (DbType = Int32), @p5='?' (Size = 4000), @p6='?' (Size = 4000), @p7='?' (Size = 4000)], CommandType='Text', CommandTimeout='30']
      SET NOCOUNT ON;
      INSERT INTO [Log] ([CreatedOnUtc], [CustomerId], [FullMessage], [IpAddress], [LogLevelId], [PageUrl], [ReferrerUrl], [ShortMessage])
      VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7);
      SELECT [Id]
      FROM [Log]
      WHERE @@ROWCOUNT = 1 AND [Id] = scope_identity();
System.Data.SqlClient.SqlException (0x80131904): Cannot insert the value NULL into column 'Id', table 'JPITstoreExampleDB.dbo.Log'; column does not allow nulls. INSERT fails.
The statement has been terminated.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
ClientConnectionId:18bc9522-8b82-4e1d-812a-8e06f20cbdc7
Error Number:515,State:2,Class:16
fail: Microsoft.EntityFrameworkCore.Update[10000]
      An exception occurred in the database while saving changes for context type 'Nop.Data.NopObjectContext'.
      Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'Id', table 'JPITstoreExampleDB.dbo.Log'; column does not allow nulls. INSERT fails.
      The statement has been terminated.
         at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
         at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
         at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
         at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
         at System.Data.SqlClient.SqlDataReader.get_MetaData()
         at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
         at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
         at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
         at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
         at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
         at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
         --- End of inner exception stack trace ---
         at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
         at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(DbContext _, ValueTuple`2 parameters)
         at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
         at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IReadOnlyList`1 entriesToSave)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
         at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'Id', table 'JPITstoreExampleDB.dbo.Log'; column does not allow nulls. INSERT fails.
The statement has been terminated.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(DbContext _, ValueTuple`2 parameters)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IReadOnlyList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
Application startup exception: System.InvalidOperationException: The property 'Id' on entity type 'Log' has a temporary value while attempting to change the entity's state to 'Unchanged'. Either set a permanent value explicitly or ensure that the database is configured to generate values for this property.
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState(EntityState oldState, EntityState newState, Boolean acceptChanges)
   at Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry.set_State(EntityState value)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Nop.Data.EfRepository`1.GetFullErrorTextAndRollbackEntityChanges(DbUpdateException exception) in C:\Users\Joe\Desktop\x\Libraries\Nop.Data\EfRepository.cs:line 51
   at Nop.Data.EfRepository`1.Insert(TEntity entity) in C:\Users\Joe\Desktop\x\Libraries\Nop.Data\EfRepository.cs:line 86
   at Nop.Services.Logging.DefaultLogger.InsertLog(LogLevel logLevel, String shortMessage, String fullMessage, Customer customer) in C:\Users\Joe\Desktop\x\Libraries\Nop.Services\Logging\DefaultLogger.cs:line 221
   at Nop.Services.Logging.DefaultLogger.Information(String message, Exception exception, Customer customer) in C:\Users\Joe\Desktop\x\Libraries\Nop.Services\Logging\DefaultLogger.cs:line 238
   at Nop.Web.Framework.Infrastructure.Extensions.ServiceCollectionExtensions.ConfigureApplicationServices(IServiceCollection services, IConfiguration configuration) in C:\Users\Joe\Desktop\x\Presentation\Nop.Web.Framework\Infrastructure\Extensions\ServiceCollectionExtensions.cs:line 58
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
crit: Microsoft.AspNetCore.Hosting.Internal.WebHost[6]
      Application startup exception
System.InvalidOperationException: The property 'Id' on entity type 'Log' has a temporary value while attempting to change the entity's state to 'Unchanged'. Either set a permanent value explicitly or ensure that the database is configured to generate values for this property.
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState(EntityState oldState, EntityState newState, Boolean acceptChanges)
   at Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry.set_State(EntityState value)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Nop.Data.EfRepository`1.GetFullErrorTextAndRollbackEntityChanges(DbUpdateException exception) in C:\Users\Joe\Desktop\x\Libraries\Nop.Data\EfRepository.cs:line 51
   at Nop.Data.EfRepository`1.Insert(TEntity entity) in C:\Users\Joe\Desktop\x\Libraries\Nop.Data\EfRepository.cs:line 86
   at Nop.Services.Logging.DefaultLogger.InsertLog(LogLevel logLevel, String shortMessage, String fullMessage, Customer customer) in C:\Users\Joe\Desktop\x\Libraries\Nop.Services\Logging\DefaultLogger.cs:line 221
   at Nop.Services.Logging.DefaultLogger.Information(String message, Exception exception, Customer customer) in C:\Users\Joe\Desktop\x\Libraries\Nop.Services\Logging\DefaultLogger.cs:line 238
   at Nop.Web.Framework.Infrastructure.Extensions.ServiceCollectionExtensions.ConfigureApplicationServices(IServiceCollection services, IConfiguration configuration) in C:\Users\Joe\Desktop\x\Presentation\Nop.Web.Framework\Infrastructure\Extensions\ServiceCollectionExtensions.cs:line 58
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
Hosting environment: Production
Content root path: C:\data\sites\store.justperfectit.com
Now listening on: http://127.0.0.1:32749
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://store.justperfectit.com/  
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 111.1042ms 500 text/html; charset=utf-8
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://store.justperfectit.com/favicon.ico  
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 0.2031ms 500 text/html; charset=utf-8
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.