Inhalte aufrufen

Profilbild

Smartstore Error


45 Antworten zu diesem Thema

#41 Olamide

Olamide

    Advanced Member

  • Members
  • 31 Beiträge

Geschrieben: 27 July 2018 - 13:47

Hello Marcus,

 

I was able to resolve the above by closing and re-opening Visual Studio but there is another major error that i am finding hard to resolve:

 

 

 
 
PM> add-migration Merge -IgnoreChanges
System.ApplicationException: 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.
   at SmartStore.Data.ObjectContextBase.GetConnectionString() in \source\repos\SmartStoreNET\src\Libraries\SmartStore.Data\ObjectContextBase.cs:line 379
   at SmartStore.Data.ObjectContextBase..ctor() in \source\repos\SmartStoreNET\src\Libraries\SmartStore.Data\ObjectContextBase.cs:line 31
   at SmartStore.Data.SmartObjectContext..ctor() in \source\repos\SmartStoreNET\src\Libraries\SmartStore.Data\SmartObjectContext.cs:line 34
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Data.Entity.Infrastructure.DbContextInfo.CreateInstance()
   at System.Data.Entity.Infrastructure.DbContextInfo..ctor(Type contextType, DbProviderInfo modelProviderInfo, AppConfig config, DbConnectionInfo connectionInfo, Func`1 resolver)
   at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration, DbContext usersContext, DatabaseExistenceState existenceState, Boolean calledByCreateDatabase)
   at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration)
   at System.Data.Entity.Migrations.Design.MigrationScaffolder..ctor(DbMigrationsConfiguration migrationsConfiguration)
   at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.RunCore()
   at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
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.
PM> 


#42 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3264 Beiträge

Geschrieben: 27 July 2018 - 14:45

Did you also select SmartStore.Data as starting project in the package manager console?
Does the file App_Data\Tenants\Default\Settings.txt exist in your installation and does its content point to the correct database? 
 
Here is one and another thread with the same problem... and note that the path to settings.txt has changed. It is now App_Data\Tenants\Default\Settings.txt.

Schöne Grüße aus Düsseldorf,
Marcus Gesing


#43 Olamide

Olamide

    Advanced Member

  • Members
  • 31 Beiträge

Geschrieben: 27 July 2018 - 15:51

Hello Marcus,

 

Thanks for the assistance so far.

 

I followed the thread carefully, created the Settings.txt with the required parameters and did the following

 

add-migration Merge -IgnoreChanges
Unable to generate an explicit migration because the following explicit migrations are pending: [201403112331027_Initial, 201403210038385_AclPerf, 201403211655284_CurrencyMorePrecision, 201403251610279_AboutPage, 201403262015448_ImportExcel, 201404032144400_Packaging, 201404101903014_AttributeCombinationPrice, 201404170814451_BundleYouSaveLabelFix, 201404232319321_LessValidation, 201404292222025_FixMaxLength, 201405071457441_FixRes1, 201405080948530_ProductBulkEditInfo, 201405282243489_TaskUpdate, 201406122329031_ContentDeliveryNetwork, 201406262150229_Providers, 201407191010096_BetterReturnRequest, 201408071158147_MultistorePoll, 201408291450443_CheckoutCommmentBox, 201409150936394_CustomerNameFormat, 201410091620122_NewRes, 201411182201537_EuEsd, 201411182202431_V21Final, 201412081934318_V211, 201501191849483_WidgetWrapContent, 201501221417371_DefaultViewModeForCategories, 201502120858030_Licensing, 201502191643156_QtyUnitsAndOrderItemTaxRate, 201502202248081_NewIndexesV22, 201502280342294_LocalizedPropertyIndex, 201503032227054_V22Res, 
 
ran an update database command
 
lunch the website but got this error message:
 
 
 
Server Error in '/' Application. 'Guests' role could not be loaded

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: SmartStore.SmartException: 'Guests' role could not be loaded

Source Error:



Line 372: var guestRole = GetCustomerRoleBySystemName(SystemCustomerRoleNames.Guests);
Line 373: if (guestRole == null)
Line 374: throw new SmartException("'Guests' role could not be loaded");
Line 375:
Line 376:            using (new DbContextScope(autoCommit: true))

Source File: source\repos\SmartStoreNET\src\Libraries\SmartStore.Services\Customers\CustomerService.cs    Line: 374         

 

thanks   



#44 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3264 Beiträge

Geschrieben: 27 July 2018 - 18:32

The initial Migration is pending? Really? What kind of project is it? Local developer or productive live shop?
I would recommend a new installation: Delete Settings.txt, open the shop and execute the installation.

Schöne Grüße aus Düsseldorf,
Marcus Gesing


#45 Olamide

Olamide

    Advanced Member

  • Members
  • 31 Beiträge

Geschrieben: 27 July 2018 - 22:30

Hello Marcus,

 

I was able to figure it out after much trial and error, it's still a Local developer. it is working now.

 

Am currently working on how to implement the Multi-Vendor.

 

Thanks for your support so far



#46 Olamide

Olamide

    Advanced Member

  • Members
  • 31 Beiträge

Geschrieben: 30 July 2018 - 12:27

Dear Marcus,

 

Please assist, am getting an error on this Method:

 

 

public static void UpdateDownloadTransientStateFor<TEntity>(TEntity entity, Expression<Func<TEntity, int>> downloadIdProp, bool save = false) where TEntity : BaseEntity
{
Guard.NotNull(entity, nameof(entity));
Guard.NotNull(downloadIdProp, nameof(downloadIdProp));
 
var propName = downloadIdProp.ExtractMemberInfo().Name;
int? currentDownloadId = downloadIdProp?.Compile()?.Invoke(entity);// this line of code is generating object reference not set to an instant of an object
var rs = EngineContext.Current.Resolve<IRepository<Download>>();
 
UpdateTransientStateForEntityInternal(entity, propName, currentDownloadId.HasValue?currentDownloadId.Value:0, rs, null, save);
}
 
Thanks




Auf dieses Thema antworten