Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi Kristoffer
Unfortunately, I can't replicate the issue. Would you mind sharing full source of your program and startup? Alternatively, you can see my test recording from here https://www.youtube.com/watch?v=KzjKMr3NsgQ to compare with your one.
Hi!
I just figured it out.
I my old solution I was using |DataDirectory| do attach a local database so my connectionstring looked like this:
"EPiServerDB": "Data Source=(LocalDb)\\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\\EPiServerDB_f6c7a112.mdf;Initial Catalog=EPiServerDB_f6c7a112;Connection Timeout=60;Integrated Security=True;MultipleActiveResultSets=True"
To be able to use |DataDirectory| I found some where that you could do this in your Configure:
string baseDir = env.ContentRootPath;
AppDomain.CurrentDomain.SetData("DataDirectory", System.IO.Path.Combine(baseDir, "App_Data"));
It looks like ConfigureCmsDefaults() tries to connect to the database using the current connectionstring and that one is not modified yet.
So I guess there is some kind of exception in ConfigureCmsDefaults() that is not shown that causes the startup to break.
Changing |DataDirectory| to the actuall path to the database made the startup to work correctly.
/Kristoffer
Hi!
I'm trying to upgrade a CMS site and when using .ConfigureCmsDefaults() in Program.cs
return Host.CreateDefaultBuilder(args) .ConfigureAppConfiguration(config => { config.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("COMPUTERNAME")}.json", optional: true, reloadOnChange: true); }) .ConfigureCmsDefaults() .UseSerilog() .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
the method:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
is not called in Startup.cs.
If I remove .ConfigureCmsDefaults() the method get called.
Any ideas?
/Kristoffer