TheKnyazz wrote:
I switched on the errors and it says that there is
"Cannot insert the value NULL into column 'Id', table 'u332215.dbo.Customer'; column does not allow nulls. INSERT fails.
The statement has been terminated."

And there is stack trace
"[SqlException (0x80131904): Cannot insert the value NULL into column 'Id', table 'u332215.dbo.Customer'; column does not allow nulls. INSERT fails.
The statement has been terminated.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2073502
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5064460
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
   System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
   System.Data.SqlClient.SqlDataReader.get_MetaData() +86
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +311
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
   System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
   System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10
   System.Data.Mapping.Update.Internal.DynamicUpdateCommand.Execute(UpdateTranslator translator, EntityConnection connection, Dictionary`2 identifierValues, List`1 generatedValues) +8168800
   System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter) +267

[UpdateException: An error occurred while updating the entries. See the inner exception for details.]
   System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter) +389
   System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache) +163
   System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options) +609
   System.Data.Entity.Internal.InternalContext.SaveChanges() +120

[DbUpdateException: An error occurred while updating the entries. See the inner exception for details.]
   System.Data.Entity.Internal.InternalContext.SaveChanges() +206
   System.Data.Entity.Internal.LazyInternalContext.SaveChanges() +24
   System.Data.Entity.DbContext.SaveChanges() +20
   Nop.Data.EfRepository`1.Insert(T entity) in f:\Own\NopCommerce\Sources\src\Libraries\Nop.Data\EfRepository.cs:41
   Nop.Services.Customers.CustomerService.InsertGuestCustomer() in f:\Own\NopCommerce\Sources\src\Libraries\Nop.Services\Customers\CustomerService.cs:350
   Nop.Web.Framework.WebWorkContext.GetCurrentCustomer() in f:\Own\NopCommerce\Sources\src\Presentation\Nop.Web.Framework\WebWorkContext.cs:117
   Nop.Web.Framework.WebWorkContext.get_CurrentCustomer() in f:\Own\NopCommerce\Sources\src\Presentation\Nop.Web.Framework\WebWorkContext.cs:185
   Nop.Web.MvcApplication.SetWorkingCulture() in f:\Own\NopCommerce\Sources\src\Presentation\Nop.Web\Global.asax.cs:200
   Nop.Web.MvcApplication.Application_AuthenticateRequest(Object sender, EventArgs e) in f:\Own\NopCommerce\Sources\src\Presentation\Nop.Web\Global.asax.cs:144
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75"

As I understand it fails some kind of initialization.

To make it clear, to install manually, db which I've created on my local machine(when I succesfully installed nop) and exported to hoster's mssql server.



Greg Smyth wrote:

Add on to above post.
I have a vps server and if I stop and restart the server I can get to the main page. the problem above occurs at login.



I faced the exact same problem as above and after few hours of googling i figured out what exactly was the cause of above error in my website.

Cause: I took backup of my database and recreated on other sql server. When i checked the new database i found there are no dependencies between related tables and also no primary keys set on tables.

Fix: Recheck your database if you have recreated or restored the old backup as in my case. After your database is fixed, go to IIS and refresh the application pool. If you do not have access to IIS directly as in most cases, go to root directory of your website and edit web.config file by adding a space at the end of file and re-save it. This will refresh the application pool itself.

Hope it helps others facing the same problem.