Disabling Default PhysicalFileSystem/"www/root" Folder Use

I have a custom media file system that I am using for my Umbraco CMS 13 application. When testing locally, the media file system correctly interacts with the Umbraco file system to take over media handling. However, when testing locally, the /www/root folder still exists, even though it is empty and not used. For my non-local testing, I did not incorporate a www/root folder since it is not used. However, I am now getting a System.IO.IOException: Permission denied error on Umbraco’s manipulation of the www/root folder because the system umbraco is running on does not have permissions to create or interact with the folder.

How do I disable the need for the system to interact with this folder since it is not being used at all? It seems that by default the recommended way to replace the PhysicalFileSystem is to use SetMediaFileSystem on the IUmbracoBuilder but I am doing so and still encountering this issue so it does not seem as if that alone removes the need for the folder. I am using .NET 8 for reference.

Umbraco needs the /wwwroot directory to work, and it’s for more than just media.

Try this fun experiment: Publish your site to a folder on your local machine, then have a look inside the /wwwroot folder in the output.

/wwwroot is where all of ASP.NET Core’s static files are served from by default and all of Umbraco’s (many) static assets, as well as those for any packages, will get merged into the /wwwroot folder when published.

When you’re running in development mode locally, these assets get served directly from their NuGet packages - if you look in obj\Debug\net8.0\staticwebassets.build.json you can see all the static assets being referenced and where they’re coming from.

1 Like