dotvvm - DotVVM 2.0 - 无法运行试用 Business Pack 控件
问题描述
我已经使用 Visual Studio 创建了一个 DotVVM Core 2.0 项目,并且我已经激活了我从私人订阅源添加到该项目中的 Business Pack 试用版。我已经在 ConfigureServices 的 DotvvmStartup.cs 中注册了 Business Pack。我在 IntelliSense 中看不到 bp 控件,当我尝试使用 bp 控件运行 Web 应用程序时,我收到一个错误,即 tagprefix 未注册。
我使用最新版本的 Visual Studio 2017 Community 和最新版本的 DotVVM 和 Business Pack。感谢您的任何建议。
解决方案
也许你不会调用 method
DotvvmStartup.ConfigureServices
。这是由 VS2017 扩展模板(v2.0.118.0 及更低版本)和 dotnet CLI 模板(dotvvm.templates.2.0.3)中的“错误”引起的。
请检查Startup.ConfigureServices
。
public void ConfigureServices(IServiceCollection services)
{
...
services.AddDotVVM(); //this line is incorrect
}
您应该替换services.AddDotVVM()
为services.AddDotVVM<DotvvmStartup>();
https://github.com/riganti/dotvvm/blob/master/src/DotVVM.Framework.Hosting.AspNetCore/ServiceCollectionExtensions.cs#L17
这将创建实例DotvvmStartup
并调用方法DotvvmStartup.ConfigureServices
。
DotvvmStartup 对象被创建 2 次(services.AddDotVVM<DotvvmStartup>()
和app.UseDotVVM<DotvvmStartup>(env.ContentRootPath)
)。
推荐阅读
- c# - Orchestrator 功能失败:活动功能失败:“无法解析功能名称”
- mips - 寄存器中的基数和偏移量
- reactjs - react-onesignal:通知提示后订阅 Onesignal
- bash - 为什么相同的代码在 circleci 和 github Actions 上产生不同的结果
- php - 检查请求是直接用户发起的请求还是浏览器发起的请求
- javascript - 如何将事件侦听器添加到组件并在用户单击窗口中的其他任何位置时将其删除?
- javascript - 如何在使用 jsPDF 保存/下载之前预览 pdf 文件?
- javascript - 值 === 表达式和表达式 === 值之间的区别?
- docker - 在使用 jenkins 管道在 docker 容器中运行时,我们如何为 npm 设置 StrictHostKeyChecking=no?
- ios - 无法在路径领域打开领域