An Error Occurred During Report Processing. -Rldc Reporting in ASP.NET MVC

An error occurred during local report processing.The definition of the report ' is invalid

EDIT: Solution seem to be that the report defintion was not loaded. It can be done for example by

var reportStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("ReportName.rdlc"); 
localReport.LoadReportDefinition(reportStream);

Old suggestion - not applicable here:

Honestly, there might be different things.
First of all, setting parameters is special. If your projects runs in .NET 4 or higher the reporting engine will run within a different app domain than your application. So you have to set permissions that the parameters can be used. Otherwise it rejects all parameter.

var report = new LocalReport();
report.SetBasePermissionsForSandboxAppDomain(new PermissionSet(PermissionState.Unrestricted));

Another issue could be that you are using a different ReportViewer version on your development machine than on the deployment machine.

RDL Report not rendering

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)

Sample Image

Now select the object and click next:-

Sample Image

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

Sample Image

then click the ok button:-

Sample Image

then you will find your database table in dataset:-

Sample Image

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

Sample Image

.................................................................
.................................................................

AGAIN UPDATE(Data base Connect)

First right click on your report project- => Add=>New Item then you will show:-

Sample Image

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

Sample Image

Sample Image

Above,click New Connection.

Sample Image

Above,click Continue.

Sample Image

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.

Sample Image

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

Sample Image

Sample Image

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

Sample Image

Sample Image

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

MVC 5 application RDLC Report throws an exception after hosting but works fine with visual studio

Without really knowing what the cause is, I can guess what it could be. It's possible that the RDLC Report File (e.g. MyReport.rdlc) was not properly deployed to target environment, or doesn't reside in the expected folder (relative paths) when the executing directory changes.

In Visual Studio, ensure that Copy to Output Directory Property is set to Copy if newer/always, and when executing on IIS, the Files could appear within \bin directory, while locally, they're probably within bin\Debug.

When passing in the File name of MyReport.rdlc, in our application, we make it configurable and construct the path like this:

var rdlcFullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConfigurationManager.AppSettings["ReportingPath"], "MyReport.rdlc");

In the web.config file, add the Path setting:

<add key="ReportingPath" value="bin\Reports" />

You can override the setting for every environment to match the target structure.

Error. An error occurred while processing your request

I believe I found what I was looking for:

How to deploy ASP.NET MVC 4 application using localDB to local IIS on Windows 7?

This did the trick, though probably not a good idea for production server.

I guess one would have to do some type of restore on the SQL server from the .mdf.

All one has to do is publish their files, drop them in the wwwroot folder (along with the app_data folder containing your database and logs) and set the pool to local and you should be set.

IIS conflict with Sql Server Reporting Services

I changed my controller from Reports to MyReports and this resolved the conflict.



Related Topics



Leave a reply



Submit