Telerik报告.NET 5演练会产生错误“ ConfigurationHelper在当前上下文中”

发布于 2025-02-02 10:51:25 字数 1383 浏览 0 评论 0原文

在.net 5'步行在这里在早期,他们会让您粘贴以下内容:

        // Configure dependencies for ReportsController.
        services.TryAddSingleton<IReportServiceConfiguration>(sp =>
        new ReportServiceConfiguration
        {
            ReportingEngineConfiguration = ConfigurationHelper.ResolveConfiguration(sp.GetService<IWebHostEnvironment>()),
            HostAppId = "Net5RestServiceWithCors",
            Storage = new FileStorage(),
            ReportSourceResolver = new UriReportSourceResolver(
                System.IO.Path.Combine(sp.GetService<IWebHostEnvironment>().ContentRootPath, "Reports"))
        });

但是 configurationHelper 被标记为“当前上下文中不存在”。

我知道我可能需要参考一个程序集,但我确实通过Nuget Telerik.Reporting.Services.aspnetcore.trial添加了所有所需的依赖项。

因此,我不知道我需要哪种组件才能获得配置求职者。

我怀疑这是一个非常愚蠢的问题,因为互联网上几乎没有关于ConfigurationHelper的问题,这意味着答案是如此简单的人甚至不需要谷歌搜索。

那么,我需要使用nuget telerik.reporting.services.aspnetcore.berial添加到全新的ASP.NET Core Web Application 5.0中,以解决configurationHelper?

Following the 'How to Host Reports Service in ASP.NET Core in .NET 5' walk through here and early on they have you paste the following in ConfigureSerivces:

        // Configure dependencies for ReportsController.
        services.TryAddSingleton<IReportServiceConfiguration>(sp =>
        new ReportServiceConfiguration
        {
            ReportingEngineConfiguration = ConfigurationHelper.ResolveConfiguration(sp.GetService<IWebHostEnvironment>()),
            HostAppId = "Net5RestServiceWithCors",
            Storage = new FileStorage(),
            ReportSourceResolver = new UriReportSourceResolver(
                System.IO.Path.Combine(sp.GetService<IWebHostEnvironment>().ContentRootPath, "Reports"))
        });

However ConfigurationHelper is flagged as 'does not exist in current context'.

I know I probably need to reference an assembly but I did add all the supposed required dependencies via nuget Telerik.Reporting.Services.AspNetCore.Trial.

So I don't know what assembly I need to get ConfigurationHelper.

I suspect this is a really stupid question because there is virtually nothing on the internet about ConfigurationHelper which means the answer is so simple people don't even need to google it.

So what do I need to add to a brand new ASP.NET Core Web Application 5.0 with nuget Telerik.Reporting.Services.AspNetCore.Trial in order to resolve ConfigurationHelper?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我的痛♀有谁懂 2025-02-09 10:51:25

configurationHelper 只是项目中的静态类,如果需要,可以重命名,然后在此行中使用reportingingingingingingingingingingingingingingingingegineconfiguration = ConfigurationHelper.ResolveconFiguration(Sp.GetService&getService&getService&lt; iwebhostenvironment&gt&gt&gt&gt&gt&gt;()

从您发布的文章中获取:

static class ConfigurationHelper
    {
        public static IConfiguration ResolveConfiguration(IWebHostEnvironment environment)
        {
            var reportingConfigFileName = System.IO.Path.Combine(environment.ContentRootPath, "appsettings.json");
            return new ConfigurationBuilder()
                .AddJsonFile(reportingConfigFileName, true)
                .Build();
        }
    }

您可以查看安装中的演示项目,该路径应类似于c:\ program文件(x86)\ progress \ progress \ telerik报告R2 2022 \ ackames \ ackames \ csharp .NET 5 \ ReportingRestServiceCorsDemo

ConfigurationHelper is just a static class in your project, you can rename it if you want, then use it in this line ReportingEngineConfiguration = ConfigurationHelper.ResolveConfiguration(sp.GetService<IWebHostEnvironment>()),

Taken from the article you have posted:

static class ConfigurationHelper
    {
        public static IConfiguration ResolveConfiguration(IWebHostEnvironment environment)
        {
            var reportingConfigFileName = System.IO.Path.Combine(environment.ContentRootPath, "appsettings.json");
            return new ConfigurationBuilder()
                .AddJsonFile(reportingConfigFileName, true)
                .Build();
        }
    }

You can have a look at the demo projects in your installation, the path should be similar to C:\Program Files (x86)\Progress\Telerik Reporting R2 2022\Examples\CSharp.NET 5\ReportingRestServiceCorsDemo

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文