using Nopcommerce 4.00 I cannot debug using iisespress or Kestrel https

1 year ago
I am having issues debugging nopcommerce 4.00 using IIS Express in Visual Studio Community 2017.

While using iis express, it freezes while spinning up debug mode. I get no error.

Using the Kestrel server, I have configured the Kestrel cert and the port and I get the following error:

Unable to load DLL 'libuv': The specified module could not be found.

I have created another web project in 2017 and it works in both environments.

For my development, I need to use https because of the connections needed to secure services such as authorization.net.

Thanks!

gman
1 year ago
OK, I restarted with a fresh copy of NopCommerce 4.00 and I was able to get this to work.

Here is my program.cs code using a self-signed cert in Kestrel for url: https://localhost:6001/:

namespace Nop.Web
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var config = new ConfigurationBuilder()
          .SetBasePath(Directory.GetCurrentDirectory())
          .AddEnvironmentVariables()
          .AddJsonFile("certificate.json", optional: true, reloadOnChange: true)
          .AddJsonFile($"certificate.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true)
          .Build();

            var certificateSettings = config.GetSection("certificateSettings");
            string certificateFileName = certificateSettings.GetValue<string>("filename");
            string certificatePassword = certificateSettings.GetValue<string>("password");

            var certificate = new X509Certificate2(certificateFileName, certificatePassword);

            BuildWebHost(args, certificate).Run();
        }

        public static IWebHost BuildWebHost(string[] args, X509Certificate2 certificate) =>
            WebHost.CreateDefaultBuilder(args)
                .UseKestrel(options =>
                {
                    options.AddServerHeader = false;
                    options.Listen(IPAddress.Any, 6001, listenOptions =>
                    {
                        listenOptions.UseHttps(certificate);
                    });
                })
                .UseStartup<Startup>()
                .Build();
    }
}

I am upgrading from Nop 3.60 to 4.00 and there are many changes I have made to the original code that I am moving to the new platform and i guess during the move, I broke something.

If I find it I will update this thread.

Thanks!