Change your code like below:-
private readonly IHostingEnvironment _webHostEnvironment;
public HomeController( IHostingEnvironment webHostEnvironment)
{
_webHostEnvironment = webHostEnvironment;
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
}
public async Task<IActionResult> Print()
{
string mimetype = "";
int extension = 1;
var path = $"{this._webHostEnvironment.WebRootPath}\\Reports\\test.rdlc";
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters.Add("rp1", "Test Value to parameter");
LocalReport localReport = new LocalReport(path);
var result = localReport.Execute(RenderType.Pdf, extension, parameters, mimetype);
return File(result.MainStream, "application/pdf");
}
Also, don't forget to install some NuGet packages as needed.
Hope it will resolve your issue. for more details and connected things, you can read this article:-
http://blog.geveo.com/IntegratingRDLCReportsToNetCoreProjects
UPDATE
App.config
<connectionStrings>
<add
name="MyConnectionString"
connectionString="Data Source=DESKTOP-N41V6ER\SQLEXPRESS;Initial
Catalog=MyDatabase;User ID=userName;Password=password"
providerName="System.Data.SqlClient"
/>
</connectionStrings>
User ID and Password means using SQL credentials, not Windows, but still very simple - just go into your Security section of your SQL Server and create a new Login. Give it a username and password, and give it rights to your database.
AGAIN UPDATE(Data Source Connect)

Now select the object and click next:-

below, the design of a simple report that allows displaying the (assume)product data in your connected database. then click finish.

then click the ok button:-

then you will find your database table in dataset:-

now you can drag and drop your data, which place you want to show in your report file.

.................................................................
.................................................................
AGAIN UPDATE(Data base Connect)
First right click on your report project- => Add=>New Item then you will show:-

above add an entity data model to the windows form project.then click Add.then:-


Above,click New Connection.

Above,click Continue.

Above, give your server name. my machine has just one (SQL server)installed for that i am using . and select SQL Server in Authentication box.

Above,then click Ok.you have obisouly select DB name which you want.


Above, type your DB name carefully which you already selected.


Above, I select my product table because I will show that. then click finish