DirectoryNotFoundException On Production Server

There is a DirectoryNotFoundException in my asp.net core application on production server. I couldn't reproduce it while debugging. It just runs properly after published. But if I build for release environment and use the released dll file on the production server, it gives this error. How could I solve this problem?

Detailed error and stack trace is right here:

DirectoryNotFoundException: C:\Users\serhat\.nuget\packages\microsoft.aspnetcore.identity.ui\5.0.3\staticwebassets\V4\
Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(string root, ExclusionFilters filters)
Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(string root)
Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsFileProvider..ctor(string pathPrefix, string contentRoot)
Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader+<>c.<UseStaticWebAssetsCore>b__2_0(ContentRootMapping cr)
System.Linq.Enumerable+SelectEnumerableIterator<TSource, TResult>.MoveNext()
System.Linq.Enumerable.OfTypeIterator<TResult>(IEnumerable source)+MoveNext()
System.Collections.Generic.List<T>..ctor(IEnumerable<T> collection)
System.Linq.Enumerable.ToList<TSource>(IEnumerable<TSource> source)
Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssetsCore(IWebHostEnvironment environment, Stream manifest)
Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssets(IWebHostEnvironment environment, IConfiguration configuration)
Microsoft.AspNetCore.WebHost+<>c.<ConfigureWebDefaults>b__9_0(WebHostBuilderContext ctx, IConfigurationBuilder cb)
Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(out AggregateException hostingStartupErrors)
Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
coreDeneme.Program.Main(string[] args)

1 answer

  • answered 2021-02-20 18:49 Monu

    please share Configure method configuration in startup class so that we can see how it has been setup.