You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用dotMemory进行内存分析时出现应用启动异常求助

Troubleshooting dotMemory Startup Failure Due to Missing wwwroot Directory

Hey there! Let's work through this issue you're hitting with dotMemory and your .NET Core app. The error is straightforward—your application can't locate the wwwroot directory at the specified path, which is causing it to crash before dotMemory can even start profiling.

The Root Cause

Your app throws a System.IO.DirectoryNotFoundException because it can't find the wwwroot folder here:

D:\Projects\Source\PishroPostCloudLoyalty\pishropost-core\Yara.PedEx.Administration\bin\Debug\netcoreapp2.2\wwwroot\

This happens during startup (specifically in Startup.cs line 155, where PhysicalFileProvider is initialized), killing the app before dotMemory can begin its analysis session.

Step-by-Step Fixes

  • Check if wwwroot exists in the output folder
    Navigate to the path listed in the error and confirm if the wwwroot folder is present. If it's missing, manually create an empty wwwroot folder there first—this will get the app running temporarily while you fix the underlying issue.

  • Ensure wwwroot is set to copy to output in your project
    In Visual Studio:

    1. Locate the wwwroot folder in your solution explorer
    2. Right-click it and select Properties
    3. Set Copy to Output Directory to Copy always or Copy if newer
      This guarantees the folder is copied to the bin/Debug/netcoreapp2.2 directory every time you build your project.
  • Clean and rebuild your solution
    Build caches can sometimes prevent files from updating correctly. Try:

    1. Going to Build > Clean Solution to clear old output files
    2. Then Build > Rebuild Solution to generate fresh artifacts
    3. Attempt to run dotMemory profiling again after this.
  • Verify your Startup.cs configuration
    Head to line 155 in Startup.cs where the error originates. If you're manually initializing a PhysicalFileProvider, double-check that the path you're passing is correct. For most ASP.NET Core apps, the default app.UseStaticFiles() automatically targets wwwroot—if you've modified this setup, confirm your path logic is accurate.

Full Error Log for Reference

应用启动异常: System.IO.DirectoryNotFoundException: D:\Projects\Source\PishroPostCloudLoyalty\pishropost-core\Yara.PedEx.Administration\bin\Debug\netcoreapp2.2\wwwroot\
在 Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
在 Yara.PedEx.Administration.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, PedExDbContext dbContext) 位置 D:\Projects\Source\PishroPostCloudLoyalty\pishropost-core\Yara.PedEx.Administration\Startup.cs:行号 155
--- 引发异常的上一位置的堆栈跟踪结束 ---
在 Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
在 Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
未处理的异常: System.IO.DirectoryNotFoundException: D:\Projects\Source\PishroPostCloudLoyalty\pishropost-core\Yara.PedEx.Administration\bin\Debug\netcoreapp2.2\wwwroot\
在 Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
在 Yara.PedEx.Administration.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, PedExDbContext dbContext) 位置 D:\Projects\Source\PishroPostCloudLoyalty\pishropost-core\Yara.PedEx.Administration\Startup.cs:行号 155
--- 引发异常的上一位置的堆栈跟踪结束 ---
在 Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
在 Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
在 Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancellationToken)
在 Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String shutdownMessage)
在 Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
在 Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
在 Yara.PedEx.Administration.Program.Main(String[] args) 位置 D:\Projects\Source\PishroPostCloudLoyalty\pishropost-core\Yara.PedEx.Administration\Program.cs:行号 23

内容的提问来源于stack exchange,提问作者Parisa Partovinia

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 22:27:46