[英]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 进程出现并可以附加到,这意味着您可以调试您的插件模块汇编代码:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.