【问题标题】:DotVVM 2.0 - unable to run trial Business Pack controlsDotVVM 2.0 - 无法运行试用 Business Pack 控件
【发布时间】:2018-12-23 00:11:58
【问题描述】:

我已经使用 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。感谢您的建议。

【问题讨论】:

    标签: dotvvm


    【解决方案1】:

    也许你不会调用方法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))。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-22
      • 1970-01-01
      • 1970-01-01
      • 2013-07-15
      • 2022-01-05
      相关资源
      最近更新 更多