asp.net核心3 rotativa startup.cs env问题 [英] asp.net core 3 rotativa startup.cs env problem

查看:84
本文介绍了asp.net核心3 rotativa startup.cs env问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Rotativaım,请遵循此指南在配置功能ım的start.cs中添加此代码

Im try to use Rotativa ım follow this guide in start.cs in configure function ım add this code

  RotativaConfiguration.Setup(env);

Severity    Code    Description Project File    Line    Suppression State
Error   CS1503  Argument 1: cannot convert from 'Microsoft.AspNetCore.Hosting.IWebHostEnvironment' to 'Microsoft.AspNetCore.Hosting.IHostingEnvironment'    

ım搜索此错误并找到此错误,然后像这样转换我的代码

ım search this error and find this and convert my code like this

 RotativaConfiguration.Setup(env.WebRootPath, "Rotativa");

及其给我这个错误

Severity    Code    Description Project File    Line    Suppression State
Error   CS1503  Argument 1: cannot convert from 'string' to 'Microsoft.AspNetCore.Hosting.IHostingEnvironment'  

ım在wwwroot中添加Rotative文件夹并添加wkhtmltoimage.exe,wkhtmltopdf.exe

ım add Rotative folder in wwwroot and added wkhtmltoimage.exe, wkhtmltopdf.exe

我的软件包版本Rotativa.aspnetcore v1.1.1ım使用当前的asp.net核心版本3.xx谁能解释我什么问题?

my package version Rotativa.aspnetcore v1.1.1 ım using current asp.net core version 3.xx what is problem any one can be explain me ?

推荐答案

我在statup.cs中的configure函数add env2和obsolute中找到了这样的解决方案

Im find a solution like this in statup.cs in configure function add env2 and obsolute

        [Obsolete]
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, Microsoft.AspNetCore.Hosting.IHostingEnvironment env2)

并像这样更改

   RotativaConfiguration.Setup(env2);

它现在可以工作,但是如果您更好地描述了它,那将是一个不好的解决方案.

its working now but ıts bad solution if you know better one pls describe it.

// Rotary configuration 
// This is for the rotating to use the files in the Rotating folder
RotativaConfiguration.Setup (env.ContentRootPath, "Rotativa");

这篇关于asp.net核心3 rotativa startup.cs env问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆