Getting started. Installing and upgrading nopCommerce.

2 years ago
Looks like no one is interested in this topic. Nopcommerce not available in the Microsoft Azure marketplace.
2 years ago
Yes I had a look and that is the only option I saw
But cant you just install as per these instructions ?
https://docs.nopcommerce.com/en/installation-and-upgrading/installing-nopcommerce/installing-on-microsoft-azure.html
I also saw this link
https://docs.nopcommerce.com/en/developer/tutorials/azure-publish.html
1 year ago
Trying to upgrade from 4.40.3 to latest 4.50.2 version. When deploying after upgrade I'm getting the
Microsoft.Data.SqlClient error. The instructions say to modify the connection string. However, I cannot figure out where to add the Encrypt=false or TrustServerCertificate=True mannually in the connection string? I've tried several ways with no luck. Any help would be great.
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name=".NET Runtime" />
  <EventID Qualifiers="0">1026</EventID>
  <Level>2</Level>
  <Task>0</Task>
  <Keywords>0x80000000000000</Keywords>
  <TimeCreated SystemTime="2022-06-12T21:05:18.265253400Z" />
  <EventRecordID>17972</EventRecordID>
  <Channel>Application</Channel>
  <Computer>XXXXXXX</Computer>
  <Security />
  </System>
- <EventData>
  <Data>Application: w3wp.exe CoreCLR Version: 6.0.322.12309 .NET Version: 6.0.3 Description: The process was terminated due to an unhandled exception. Exception Info: Autofac.Core.DependencyResolutionException: An exception was thrown while activating ?:Nop.Core.Domain.Common.CommonSettings. ---> Microsoft.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.) ---> System.ComponentModel.Win32Exception (0x80090325): The certificate chain was issued by an authority that is not trusted. at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at Microsoft.Data.SqlClient.TdsParserStateObject.ThrowExceptionAndWarning(Boolean callerHasConnectionLock, Boolean asyncClose) at Microsoft.Data.SqlClient.TdsParserStateObject.SNIWritePacket(PacketHandle packet, UInt32& sniError, Boolean canAccumulate, Boolean callerHasConnectionLock) at Microsoft.Data.SqlClient.TdsParserStateObject.WriteSni(Boolean canAccumulate) at Microsoft.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode, Boolean canAccumulate) at Microsoft.Data.SqlClient.TdsParser.TdsLogin(SqlLogin rec, FeatureExtension requestedFeatures, SessionData recoverySessionData, FederatedAuthenticationFeatureExtensionData fedAuthFeatureExtensionData) at Microsoft.Data.SqlClient.SqlInternalConnectionTds.Login(ServerInfo server, TimeoutTimer timeout, String newPassword, SecureString newSecurePassword) at Microsoft.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) at Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) at Microsoft.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) at Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken, DbConnectionPool pool) at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) at Microsoft.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) at Microsoft.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at Microsoft.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides) at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides) at Microsoft.Data.SqlClient.SqlConnection.Open() at LinqToDB.Async.AsyncDbConnection.Open() at LinqToDB.Data.DataConnection.EnsureConnection(Boolean connect) at LinqToDB.Data.DataConnection.get_Connection() at LinqToDB.Data.DataConnection.CreateCommand() at LinqToDB.Data.DataConnection.get_Command() at LinqToDB.DataProvider.DataProviderBase.InitCommand(DataConnection dataConnection, CommandType commandType, String commandText, DataParameter[] parameters, Boolean withParameters) at LinqToDB.Data.DataConnection.QueryRunner.ExecuteReader() at LinqToDB.DataContext.QueryRunner.ExecuteReader() at LinqToDB.Linq.QueryRunner.ExecuteQuery[T](Query query, IDataContext dataContext, Mapper`1 mapper, Expression expression, Object[] ps, Object[] preambles, Int32 queryNumber)+MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Nop.Data.EntityRepository`1.<>c__DisplayClass11_0.<GetAll>g__getAll|0() at Nop.Core.Caching.MemoryCacheManager.Get[T](CacheKey key, Func`1 acquire) at Nop.Data.EntityRepository`1.GetEntities(Func`1 getAll, Func`2 getCacheKey) at Nop.Data.EntityRepository`1.GetAll(Func`2 func, Func`2 getCacheKey, Boolean includeDeleted) at Nop.Web.Framework.WebStoreContext.GetCurrentStore() at Nop.Web.Framework.Infrastructure.NopStartup.<>c__DisplayClass0_0.<ConfigureServices>b__2(IServiceProvider serviceProvider) at Autofac.Extensions.DependencyInjection.AutofacRegistration.<>c__DisplayClass3_0.<Register>b__0(IComponentContext context, IEnumerable`1 parameters) at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) at Autofac.Core.Activators.Delegate.DelegateActivator.<ConfigurePipeline>b__2_0(ResolveRequestContext ctxt, Action`1 next) at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next) ClientConnectionId:e9f18448-4645-4ddc-ad4a-7fe869044940 Error Number:-2146893019,State:0,Class:20 --- End of inner exception stack trace --- at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute(ResolveRequestContext context, Action`1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.SharingMiddleware.<>c__DisplayClass5_0.<Execute>b__0() at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid id, Func`1 creator) at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid primaryId, Nullable`1 qualifyingId, Func`1 creator) at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt) at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request) at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request) at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request) at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request) at Autofac.Core.Container.ResolveComponent(ResolveRequest request) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters) at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType, IEnumerable`1 parameters) at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType) at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetService(Type serviceType) at Nop.Core.Infrastructure.NopEngine.Resolve(Type type, IServiceScope scope) at Nop.Core.Infrastructure.NopEngine.Resolve[T](IServiceScope scope) at Nop.Web.Framework.Infrastructure.Extensions.ApplicationBuilderExtensions.UseNopResponseCompression(IApplicationBuilder application) at Nop.Web.Framework.Infrastructure.NopStaticFilesStartup.Configure(IApplicationBuilder application) at Nop.Core.Infrastructure.NopEngine.ConfigureRequestPipeline(IApplicationBuilder application) at Nop.Web.Framework.Infrastructure.Extensions.ApplicationBuilderExtensions.ConfigureRequestPipeline(IApplicationBuilder application) at Program.<Main>$(String[] args)</Data>
  </EventData>
  </Event>
1 year ago
App_Data\appsettings.json

    "ConnectionString": "Data Source=Server;Initial Catalog=nopCommerce452;Integrated Security=True;Persist Security Info=False;Trust Server Certificate=True",
1 year ago
Thank you. I actually was able to use the Encrypt=false in the connection string after trying both several times and I had to restart the AppPool. The migration upgrade then loaded.  It did not make any difference where I added the syntax into the connection string.

Thank you again for your quick response.
1 year ago
Hello,

I used the source code of version 4.50.03. When I run the code and start the website I get the following error. I haven't changed anything in the code. It's a fresh install.

Thanks for the help
Best regards


InvalidOperationException: The ConnectionString property has not been initialized.
Microsoft.Data.SqlClient.SqlConnection.PermissionDemand()
Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource<DbConnectionInternal> retry, DbConnectionOptions userOptions)
Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource<DbConnectionInternal> retry, SqlConnectionOverrides overrides)
Microsoft.Data.SqlClient.SqlConnection.InternalOpenAsync(CancellationToken cancellationToken)
LinqToDB.Data.DataConnection.EnsureConnectionAsync(CancellationToken cancellationToken)
LinqToDB.Data.DataConnection+QueryRunner.ExecuteReaderAsync(CancellationToken cancellationToken)
LinqToDB.Linq.QueryRunner.ExecuteQueryAsync<T>(Query query, IDataContext dataContext, Mapper<T> mapper, Expression expression, object[] ps, object[] preambles, int queryNumber, Func<T, bool> func, TakeSkipDelegate skipAction, TakeSkipDelegate takeAction, CancellationToken cancellationToken)
LinqToDB.Linq.QueryRunner.ExecuteQueryAsync<T>(Query query, IDataContext dataContext, Mapper<T> mapper, Expression expression, object[] ps, object[] preambles, int queryNumber, Func<T, bool> func, TakeSkipDelegate skipAction, TakeSkipDelegate takeAction, CancellationToken cancellationToken)
LinqToDB.Linq.Builder.FirstSingleBuilder+FirstSingleContext+<>c__DisplayClass4_0<T>+<<GetFirstOrDefaultElement>b__1>d.MoveNext()
LinqToDB.Linq.ExpressionQuery<T>.LinqToDB.Async.IQueryProviderAsync.ExecuteAsync<TResult>(Expression expression, CancellationToken cancellationToken)
Nop.Services.Customers.CustomerService+<>c__DisplayClass54_0+<<GetCustomerRoleBySystemNameAsync>b__2>d.MoveNext() in CustomerService.cs
+
            var customerRole = await _staticCacheManager.GetAsync(key, async () => await query.FirstOrDefaultAsync());
Nop.Core.Caching.MemoryCacheManager.GetAsync<T>(CacheKey key, Func<Task<T>> acquire) in MemoryCacheManager.cs
+
            result = await acquire();
Nop.Services.Customers.CustomerService.GetCustomerRoleBySystemNameAsync(string systemName) in CustomerService.cs
+
            var customerRole = await _staticCacheManager.GetAsync(key, async () => await query.FirstOrDefaultAsync());
Nop.Services.Customers.CustomerService.InsertGuestCustomerAsync() in CustomerService.cs
+
            var guestRole = await GetCustomerRoleBySystemNameAsync(NopCustomerDefaults.GuestsRoleName);
Nop.Web.Framework.WebWorkContext.SetCurrentCustomerAsync(Customer customer) in WebWorkContext.cs
+
                    customer = await _customerService.InsertGuestCustomerAsync();
Nop.Web.Framework.WebWorkContext.GetCurrentCustomerAsync() in WebWorkContext.cs
+
            await SetCurrentCustomerAsync();
Nop.Web.Framework.Infrastructure.Extensions.ApplicationBuilderExtensions+<>c+<<UseBadRequestResult>b__4_0>d.MoveNext() in ApplicationBuilderExtensions.cs
+
                    await logger.ErrorAsync("Error 400. Bad request", null, customer: await workContext.GetCurrentCustomerAsync());
Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.HandleException(HttpContext context, ExceptionDispatchInfo edi)
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
1 year ago
epl-software wrote:
...
InvalidOperationException: The ConnectionString property has not been initialized.
Microsoft.Data.SqlClient.SqlConnection.PermissionDemand() ...


Did the app bring up the initial Install page, or did it come up with the error immediately?
If the latter, then I suspect you must have a file appsettings.json in your folder \Presentation\Nop.Web\App_Data.  (That file contains the connection string.)
For a brand new install, that folder should not have either appsettings.json or plugins.json, as those would get generated by the install.
1 year ago
New York wrote:
...
InvalidOperationException: The ConnectionString property has not been initialized.
Microsoft.Data.SqlClient.SqlConnection.PermissionDemand() ...

Did the app bring up the initial Install page, or did it come up with the error immediately?
If the latter, then I suspect you must have a file appsettings.json in your folder \Presentation\Nop.Web\App_Data.  (That file contains the connection string.)
For a brand new install, that folder should not have either appsettings.json or plugins.json, as those would get generated by the install.


The Installation page is displayed. I can enter all settings. If I click the button, NopCommerce starts to install and then the error message comes up. The appsettings.json is then in the App_Data folder, but without the connect string.
1 year ago
Delete these files from folder \Presentation\Nop.Web\App_Data
appsettings.json
plugins.json

Manually create the database using a tool like SSMS.
(If you already have the DB, then drop it and recreate it)

Are you using Integrated Security, or a User ID and Password?  In either case, in SSMS, login that way, and create a dummy table in the DB, to be sure you have permissions, etc.

If DB looks OK, then rerun the nopC installation.
1 year ago
Hi everyone,
I have a problem maybe someone help me. I developed app on 4.40 version and I posted my files on hosting. But when I click my site I got "403 - Forbidden: Access is denied. You do not have permission to view this directory or page using the credentials that you supplied" error.
How can I solve this situation ?

Hosting framework version is 4.8.0
CAS trust level is full

my web.config file is like that;
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <handlers>
      <!-- Remove WebDAV module so that we can make DELETE requests -->
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
    </handlers>
    <!-- When deploying on Azure, make sure that "dotnet" is installed and the path to it is registered in the PATH environment variable or specify the full path to it -->
    <aspNetCore requestTimeout="23:00:00" processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" forwardWindowsAuthToken="false" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" startupTimeLimit="3600" hostingModel="InProcess">
    </aspNetCore>
    <httpProtocol>
      <customHeaders>
        <remove name="X-Powered-By" />
        <!-- Protects against XSS injections. ref.: https://www.veracode.com/blog/2014/03/guidelines-for-setting-security-headers/ -->
        <add name="X-XSS-Protection" value="1; mode=block" />
        <!-- Protects against Clickjacking attacks. ref.: http://stackoverflow.com/a/22105445/1233379 -->
        <add name="X-Frame-Options" value="SAMEORIGIN" />
        <!-- Protects against MIME-type confusion attack. ref.: https://www.veracode.com/blog/2014/03/guidelines-for-setting-security-headers/ -->
        <add name="X-Content-Type-Options" value="nosniff" />
        <!-- Protects against Clickjacking attacks. ref.: https://www.owasp.org/index.php/HTTP_Strict_Transport_Security_Cheat_Sheet -->
        <add name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains" />
        <!-- CSP modern XSS directive-based defence, used since 2014. ref.: http://content-security-policy.com/ -->
        <add name="Content-Security-Policy" value="default-src 'self'; connect-src *; font-src * data:; frame-src *; img-src * data:; media-src *; object-src *; script-src * 'unsafe-inline' 'unsafe-eval'; style-src * 'unsafe-inline';" />
        <!-- Prevents from leaking referrer data over insecure connections. ref.: https://scotthelme.co.uk/a-new-security-header-referrer-policy/ -->
        <add name="Referrer-Policy" value="same-origin" />
        <!-- Permissions-Policy is a new header that allows a site to control which features and APIs can be used in the browser. ref.: https://w3c.github.io/webappsec-permissions-policy/ -->
        <add name="Permissions-Policy" value="accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=*, usb=()" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>
</configuration>