vnbaaij / Baaijte.Optimizely.ImageSharp.Web

Use SixLabors.ImageSharp.Web in Optimizely
Apache License 2.0
17 stars 15 forks source link

Can't start site when using v2.0 #10

Closed ErikHen closed 2 years ago

ErikHen commented 2 years ago

Hi Vincent. I just created a new CMS site based on the CMS-empty template (https://docs.developers.optimizely.com/content-cloud/v12.0.0-content-cloud/docs/creating-a-starter-project). I have updated to CMS v.12.5, updated to .Net 6, updated all nuget dependencies. Everything works until I add app.UseBaaijteOptimizelyImageSharp();. The site fails to start, with the error message: The provider root path cannot be determined, make sure it's explicitly configured or the webroot is set. (this line in Program.cs: public static void Main(string[] args) => CreateHostBuilder(args).Build().Run();).

Do you know what the issue is?

vnbaaij commented 2 years ago

Hi Erik,

No idea why that is happening. Are you sure you are referencing ImageSharp and ImageSharp.Web 2?

I won't be able to take a look before next week (on holiday so not at apc atm)

ErikHen commented 2 years ago

Thanks for responding so quickly. I don't expect you to look at this during your holiday, of course. The error message seems to come from https://github.com/SixLabors/ImageSharp.Web/blob/main/src/ImageSharp.Web/Providers/PhysicalFileSystemProvider.cs.

ErikHen commented 2 years ago

Hi. I've investigated this a bit more. I created a new "epi-cms-empty" project, installed Baaijte.Optimizely.ImageSharp.Web v1.0.5, everything works as expected. Updated to .net6 + everything else needed to install Baaijte.Optimizely.ImageSharp.Web v.2.0.0. I get the issue. It's definitely the PhysicalFileSystemProvider that throws an error during initialization. If I remove PhysicalFileSystemProvider from ServiceAndAppExtensions.cs everything works. It's something in the epi-cms-empty project that needs to be configured/added, because it works if I create an "epi-alloy-mvc" project. Tried adding a wildcard domain in admin mode, but that didn't help.

vnbaaij commented 2 years ago

Ok, it is actually quite simple to solve this problem. The PhysycalFileSystemProvider is being used to do the ImageSharp magic on static files. In an empty site there is no wwwroot folder to server the static files from. After you create a(n) (empty) wwwroot folder, the site will start and work again.

ErikHen commented 2 years ago

Thank you!