Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document that the web project's wwwroot folder needs to be pre-created (like with a placeholder) #17342

Open
canadacubachina opened this issue Jan 12, 2025 · 7 comments · Fixed by #17346

Comments

@canadacubachina
Copy link
Contributor

Describe the bug

The cache root path cannot be determined, make sure it's explicitly configured or the webroot is set. at SixLabors.ImageSharp.Web.Caching.PhysicalFileSystemCache.GetCacheRoot(PhysicalFileSystemCacheOptions cacheOptions, String webRootPath, String contentRootPath)

Orchard Core version

OC: 2.1.3
AZURE APP SERVICE LINUX STANDARD
.NET 8.0.301
AZURE SQL SERVER STANDARD

To Reproduce

  1. Ref OC 2.1.3
  2. Deploy to Azure App Service ( github action)
  3. Show Set up Page without problem
    1. choose Blog recipe, got 500,
      4.2. or choose SaaS, it is ok , then go to admin panel, enable media (Cache) features.
  4. See error
    HTTP ERROR 500

Expected behavior

WHEN GOT HTTP ERROR 500, WHOLE SITE IS DOWN.
1-- do not know why The WebRootPath was not found, can someone help me?
2--for GetCacheRoot(PhysicalFileSystemCacheOptions cacheOptions, String webRootPath, String contentRootPath)
maybe we can use default value for String webRootPath, or String contentRootPath for double guarantee.

Logs and screenshots

2025-01-12 19:20:53.7153|||16|Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware|WARN|The WebRootPath was not found: /home/site/wwwroot/wwwroot. Static files may be unavailable. 2025-01-12 19:20:53.9024|||14|Microsoft.Hosting.Lifetime|INFO|Now listening on: http://[::]:8080 2025-01-12 19:20:53.9147||||Microsoft.Hosting.Lifetime|INFO|Application started. Press Ctrl+C to shut down. 2025-01-12 19:20:53.9211||||Microsoft.Hosting.Lifetime|INFO|Hosting environment: Production 2025-01-12 19:20:53.9218||||Microsoft.Hosting.Lifetime|INFO|Content root path: /home/site/wwwroot 2025-01-12 19:35:14.2578|||16|Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware|WARN|The WebRootPath was not found: /home/site/wwwroot/wwwroot. Static files may be unavailable. 2025-01-12 19:35:14.4482|||14|Microsoft.Hosting.Lifetime|INFO|Now listening on: http://[::]:8080 2025-01-12 19:35:14.4653||||Microsoft.Hosting.Lifetime|INFO|Application started. Press Ctrl+C to shut down. 2025-01-12 19:35:14.4661||||Microsoft.Hosting.Lifetime|INFO|Hosting environment: Production 2025-01-12 19:35:14.4661||||Microsoft.Hosting.Lifetime|INFO|Content root path: /home/site/wwwroot 2025-01-12 19:55:19.0373|||16|Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware|WARN|The WebRootPath was not found: /home/site/wwwroot/wwwroot. Static files may be unavailable. 2025-01-12 19:55:19.2170|||14|Microsoft.Hosting.Lifetime|INFO|Now listening on: http://[::]:8080 2025-01-12 19:55:19.2280||||Microsoft.Hosting.Lifetime|INFO|Application started. Press Ctrl+C to shut down. 2025-01-12 19:55:19.2344||||Microsoft.Hosting.Lifetime|INFO|Hosting environment: Production 2025-01-12 19:55:19.2344||||Microsoft.Hosting.Lifetime|INFO|Content root path: /home/site/wwwroot

2025-01-12 20:36:01.3452|Default|00-ad542db524a0a257a0a1553511a87d7a-7cf3278d6f740d61-00|13|Microsoft.AspNetCore.Server.Kestrel|ERROR|Connection id "0HN9J8C5H3QL7", Request id "0HN9J8C5H3QL7:00000002": An unhandled exception was thrown by the application. System.InvalidOperationException: The cache root path cannot be determined, make sure it's explicitly configured or the webroot is set. at SixLabors.ImageSharp.Web.Caching.PhysicalFileSystemCache.GetCacheRoot(PhysicalFileSystemCacheOptions cacheOptions, String webRootPath, String contentRootPath) at SixLabors.ImageSharp.Web.Caching.PhysicalFileSystemCache..ctor(IOptions1 options, IWebHostEnvironment environment, FormatUtilities formatUtilities) at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span1 copyOfArgs, BindingFlags invokeAttr) at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType) at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider) at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.ReflectionMiddlewareBinder.CreateMiddleware(RequestDelegate next) at Microsoft.AspNetCore.Builder.ApplicationBuilder.Build() at OrchardCore.Modules.ShellPipelineExtensions.BuildPipelineInternalAsync(ShellContext context) at OrchardCore.Modules.ShellPipelineExtensions.BuildPipelineAsync(ShellContext context) at OrchardCore.Modules.ModularTenantRouterMiddleware.Invoke(HttpContext httpContext) at OrchardCore.Modules.ModularTenantContainerMiddleware.<>c__DisplayClass4_0.<b__0>d.MoveNext() --- End of stack trace from previous location --- at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func2 execute, Boolean activateShell) at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func2 execute, Boolean activateShell) at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func2 execute, Boolean activateShell) at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func2 execute, Boolean activateShell) at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func2 execute, Boolean activateShell) at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application) at SixLabors.ImageSharp.Web.Caching.PhysicalFileSystemCache.GetCacheRoot(PhysicalFileSystemCacheOptions cacheOptions, String webRootPath, String contentRootPath) at SixLabors.ImageSharp.Web.Caching.PhysicalFileSystemCache..ctor(IOptions1 options, IWebHostEnvironment environment, FormatUtilities formatUtilities) at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span1 copyOfArgs, BindingFlags invokeAttr) at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType) at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider) at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.ReflectionMiddlewareBinder.CreateMiddleware(RequestDelegate next) at Microsoft.AspNetCore.Builder.ApplicationBuilder.Build() at OrchardCore.Modules.ShellPipelineExtensions.BuildPipelineInternalAsync(ShellContext context) at OrchardCore.Modules.ShellPipelineExtensions.BuildPipelineAsync(ShellContext context) at OrchardCore.Modules.ModularTenantRouterMiddleware.Invoke(HttpContext httpContext) at OrchardCore.Modules.ModularTenantContainerMiddleware.<>c__DisplayClass4_0.<b__0>d.MoveNext() --- End of stack trace from previous location --- at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func2 execute, Boolean activateShell) at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func2 execute, Boolean activateShell) at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func2 execute, Boolean activateShell) at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func2 execute, Boolean activateShell) at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func2 execute, Boolean activateShell) at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application)

@Piedone
Copy link
Member

Piedone commented Jan 13, 2025

Try to add a wwwroot folder under your web project. It can be empty. Does this fix the issue?

@canadacubachina
Copy link
Contributor Author

canadacubachina commented Jan 13, 2025

@Piedone Thank you for your reply. I just made it successful.
I think we should put the following on the OrchardCore.Cms.Web.csproj:

<ItemGroup>
  <Content Update="wwwroot\.placeholder">
    <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
  </Content>
</ItemGroup>

What is your idea?

@Piedone
Copy link
Member

Piedone commented Jan 13, 2025

There's already a .placeholder files specifically for this. However, this is perhaps worthwhile to point out in the getting started docs. Perhaps something you'd be open to contribute? https://docs.orchardcore.net/en/latest/contributing/contributing-documentation/

@Piedone Piedone changed the title The WebRootPath was not found Document that the web projec't wwwroot folder needs to be pre-created (like with a placeholder) Jan 13, 2025
@Piedone Piedone changed the title Document that the web projec't wwwroot folder needs to be pre-created (like with a placeholder) Document that the web project's wwwroot folder needs to be pre-created (like with a placeholder) Jan 13, 2025
@canadacubachina
Copy link
Contributor Author

just .placeholder is not enough, should add 👍

<Content Update="wwwroot\.placeholder">
  <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>

@Piedone
Copy link
Member

Piedone commented Jan 13, 2025

Hmm, it works without adding anything to the csproj for me. Anyway, that wouldn't hurt.

@Piedone
Copy link
Member

Piedone commented Jan 14, 2025

@Piedone Piedone reopened this Jan 14, 2025
@sebastienros sebastienros added this to the 3.x milestone Jan 16, 2025
Copy link
Contributor

We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).

This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants