debugging 如何使用多个项目调试Blazor Web程序集

qojgxg4l  于 2023-08-06  发布在  其他
关注(0)|答案(1)|浏览(102)

我有一个Blazor Web组件项目,其中包含多个应用程序。我是Blazor的新手,我的问题是如何调试wasm.core中的文件。我试过在Chrome中调试的方法[ALT + SHIFT + D],但没有文件显示在f12检查中。整个项目没有launchSettings.json文件。
知道怎么调试文件吗
debug the page on wasm.core
debug the services on wasm.core

czq61nw1

czq61nw11#

我能够调试剃刀文件的代码部分:


的数据
首先,在打开解决方案后,应重新生成launchSettings.json文件。如果没有重新生成,可以手动添加此文件,可以将以下内容添加到launchSettings.json中:

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:28411",
      "sslPort": 44317
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "<Your Project Name here>": {
      "commandName": "Project",
      "dotnetRunMessages": "true",
      "launchBrowser": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

字符串
launchSettings.json文件的结构:



在此之后,您需要在打开的网站中执行一些交互操作以进入代码(什么样的交互由您正在编写的代码确定)。
顺便说一下,要选择要调试的启动项目,可以右键单击该项目,然后单击“设置为启动项目”:



之后,如果您按f5,您将开始调试项目。
有关更多信息,您可以参考此官方文档:
Debug ASP.NET Core Blazor WebAssembly

相关问题