简体   繁体   English

如果主 web 应用程序在 IIS 下运行,如何在 VS 中调试 Blazor 项目(插件模块)?

[英]How to debug Blazor project (plugin module) in VS if main web app running under IIS?

This scenario is where there is a Blazor web application platform, inside of which plugin modules can be run.这个场景是有一个Blazor web的应用平台,里面可以运行插件模块。 Specifically in my case this is the Oqtane platform , but the question could apply to other Blazor web app platforms eg ABP.io.特别是在我的情况下,这是Oqtane 平台,但该问题可能适用于其他 Blazor web 应用程序平台,例如 ABP.io。 The plugin modules are basically assemblies, that are loaded into the platform application at runtime.插件模块基本上是程序集,在运行时加载到平台应用程序中。

My question is - how to debug a plugin module where the platform is running under IIS, ie the platform is NOT being launched via Visual Studio.我的问题是 - 如何调试平台在 IIS 下运行的插件模块,即平台不是通过 Visual Studio 启动的。

I know that one way to do this would be to get the platform source code, open its solution in Visual Studio, then add the plugin module projects to the solution, and launch the whole application from VS.我知道这样做的一种方法是获取平台源代码,在 Visual Studio 中打开它的解决方案,然后将插件模块项目添加到解决方案中,然后从 VS 启动整个应用程序。

However, for various reasons I prefer to run my development instance of the platform under IIS, and maintain a VS solution that just contains the plugin module projects, and copy the DLLs and wwwroot content into the instance on build (and restart the IIS app pool).然而,出于各种原因,我更喜欢在 IIS 下运行我的平台开发实例,并维护一个只包含插件模块项目的 VS 解决方案,并将 DLL 和 wwwroot 内容复制到构建实例中(并重新启动 IIS 应用程序池).

So this approach does work, except I can't see how to debug my plugin module code when the app is running.所以这种方法确实有效,除了我看不到在应用程序运行时如何调试我的插件模块代码。 If this was a WebForms or MVC application, I would use the VS "attach to process" command to attach to w3wp.exe.如果这是一个 WebForms 或 MVC 应用程序,我会使用 VS“附加到进程”命令附加到 w3wp.exe。 However, Blazor apps running under IIS clearly don't work like that.但是,在 IIS 下运行的 Blazor 应用程序显然不能那样工作。

FYI, the app runs in Blazor Server mode (not WebAssembly), and is .NET 6.0仅供参考,该应用程序以 Blazor 服务器模式(不是 WebAssembly)运行,并且是 .NET 6.0

Is this kind of approach possible, and how?这种方法是否可行,如何实现?

It seems I was mistaken about not being able to use Attach to Process to attach to w3wp.exe (due to some misconfiguration, the process was not showing up to attach to).似乎我错误地认为无法使用 Attach to Process 来附加到 w3wp.exe(由于一些错误配置,该进程没有显示为附加)。

If you make the following selections on the Attach to Process window, you should find that the w3wp.exe process shows up and can be attached to, which means you can debug your plugin module assembly code:如果您在 Attach to Process window 上进行以下选择,您应该会发现 w3wp.exe 进程出现并可以附加到,这意味着您可以调试您的插件模块汇编代码:

  • Connection type: Default连接类型:默认
  • Connection target: your machine连接目标:你的机器
  • Attach to: Managed (.NET Core, .NET 5+) code附加到:托管(.NET Core,.NET 5+)代码
  • Show processes for all users: checked显示所有用户的进程:选中

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在VS Dev Server和IIS下运行Web应用程序有什么区别? - What are the differences between running a web app under the VS Dev Server and under IIS? VS2013:如何在特定应用程序域下调试Web应用程序? - VS2013: How to debug a web application under a specific app domain? 在IIS下运行的网站的调试dll - Debug dll of website running under IIS 如何防止WCF项目在IIS Express下运行 - How to prevent a WCF project from running under IIS Express 在调试模式下运行 blazor 应用程序时出错 - Error while running blazor app in debug mode 调试在 VS Mac 中不起作用 - Blazor web 应用程序 - Debugging is not working in VS Mac - Blazor web app Blazor 在 VS2019 中运行在调试但未发布 - Blazor running in VS2019 works in debug but not release 如何在 Blazor 应用程序引用的单独项目(在同一解决方案中)中调试代码? - How do I debug code in a separate project (in same solution) that a Blazor app references? 无法启动IIS Web服务器,如何调试 - Unable to launch the IIS Web Server, how to debug 如何在启动和停止 Blazor Web 项目时启动 API 项目的实例并使其保持运行? - How can I start an instance of my API project and keep it running while I start and stop my Blazor web project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM