小编Jon*_*KAS的帖子

ASP.Net核心寄存器控制器在运行时

我问自己是否有可能Controller在运行时加载带有s 的DLL 并使用它.

我发现的唯一的解决办法是通过添加组件ApplicationPartStartUp:

var builder = services.AddMvc();
builder.AddApplicationPart(
    AssemblyLoadContext.Default.LoadFromAssemblyPath(
        @"PATH\ExternalControllers.dll"
));
Run Code Online (Sandbox Code Playgroud)

有人知道是否可以随时注册Controller,因为该解决方案的问题是,WebService当你想要添加另一个带有Controllers的DLL时,你必须重新启动它.如果您可以随时添加它们并在应用程序中随时注册它们会很好.

.net c# .net-assembly asp.net-core-mvc asp.net-core

7
推荐指数
2
解决办法
9751
查看次数

标签 统计

.net ×1

.net-assembly ×1

asp.net-core ×1

asp.net-core-mvc ×1

c# ×1