DirectoryNotFoundException
Describe the bug
I'm getting a DirectoryNotFoundException during startup after installing uSync on a (pretty much) clean Umbraco 10.0.0-rc2 installation. Which is weird because the directory mentioned in the error message does exist.
To Reproduce Steps to reproduce the behavior:
- Install and build Umbraco 10.0.0-rc2
- Install uSync using the following CLI command
dotnet add package uSync -v 10.0.0-beta1 - Build the project either by running
dotnet buildor by using Visual Studio (in my case 2022) - Run the website on local IIS using these instructions: https://our.umbraco.com/Documentation/Fundamentals/Setup/install/iis
- Open the local URL in the browser
Error message
System.IO.DirectoryNotFoundException: C:\Users\[user]\.nuget\packages\usync.backoffice.assets\10.0.0-beta1\staticwebassets\
at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root)
at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.<>c.<UseStaticWebAssetsCore>b__1_0(String contentRoot)
at Microsoft.AspNetCore.StaticWebAssets.ManifestStaticWebAssetFileProvider..ctor(StaticWebAssetManifest manifest, Func`2 fileProviderFactory)
at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssetsCore(IWebHostEnvironment environment, Stream manifest)
at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssets(IWebHostEnvironment environment, IConfiguration configuration)
at Microsoft.AspNetCore.WebHost.<>c.<ConfigureWebDefaults>b__9_0(WebHostBuilderContext ctx, IConfigurationBuilder cb)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass9_0.<ConfigureAppConfiguration>b__0(HostBuilderContext context, IConfigurationBuilder builder)
at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at Umbraco.Cms.Web.Common.Hosting.UmbracoHostBuilderDecorator.Build()
at Application.Web.Program.Main(String[] args) in D:\Dev\umbraco-base\src\Application.Web\Program.cs:line 10
About your Site (please complete the following information):
- Umbraco Version: 10.0.0-rc2
- uSync Version: 10.0.0-beta1
- Browser: any browser
Additional context
I'm running the website on local IIS with the .NET Core Hosting Bundle 6.0.5 installed. However, when using dotnet run to run the website on Kestrel I don't get the error. Any help or suggestions would be appreciated.
Never mind. After deleting the .vs folder and cleaning and rebuilding the solution using Visual Studio the problem on my local IIS was somehow resolved.
Hmm, I keep bumping into this issue when using local IIS. Even on a freshly installed laptop. Deleting the .vs folder or cleaning/rebuilding the solution doesn't resolve the issue this time around. Any idea what might be causing this issue?
I granted Read permissions to IIS_IUSRS for the C:\Users\<username>\.nuget folder which seems to have fixed the issue.
Running into the exact same issue with Umbraco 10.0.1 and uSync 10.0.0 running on Local IIS
If you run Umbraco with local IIS but not published (so pointing IIS at the your code folder) then you will need to give the account that the IIS site is running on access to the nuget cache folder. (which is typically c:\users\username\.nuget\packages) this is because this is where the files are being served from during development.
if the site is published to IIS then the files end up in wwwroot/app_plugins and this will typeically have the correct permissions.
this is also how Umbraco are doing this in Umbraco 10, (the /umbraco folder is coming from the nuget cache during development).
totally understand there are reasons to want to run IIS over IIS Express or Ketral, but if you don't need them i would recommend using either dotnet run or running via IIS Express in Visual Studio
@KevinJump @TimBoonstra Yes, granting Read permissions to IIS_IUSRS for c:\users\<username>\.nuget\packages fixed the issue for me.
I've created a PR to add these instructions to the Umbraco documentation: https://github.com/umbraco/UmbracoDocs/pull/4205