logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
sanyami  
#1 Posted : Friday, November 24, 2017 6:47:20 AM(UTC)
sanyami

Rank: Newbie

Groups: Registered
Joined: 11/20/2017(UTC)
Posts: 11
India

Thanks: 1 times
I created seal report and I integrate into MVC. I copy and past report in (Repository\Reports) folder and run my project and I got following error:

Got unexpected exception:
Unable to read the file 'D:\RND\SealReportDemo\Repository\Reports\Search - Orders.srex'. There was an error reflecting type 'Seal.Model.Report'.

What should I do after creating report?

So I need some help to integrate this report solution in my MVC solution, maybe some snippet code or some info about this it is appreciated.

Edited by user Friday, November 24, 2017 6:49:21 AM(UTC)  | Reason: Not specified

epf  
#2 Posted : Friday, November 24, 2017 7:26:42 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
Hi it is difficult to say, there are many ways to integrate SR in your own MVC application.
Check:
https://sealreport.org/f...=posts&t=102#post226

Edited by user Friday, November 24, 2017 8:40:38 AM(UTC)  | Reason: Not specified

sanyami  
#3 Posted : Friday, November 24, 2017 11:48:44 AM(UTC)
sanyami

Rank: Newbie

Groups: Registered
Joined: 11/20/2017(UTC)
Posts: 11
India

Thanks: 1 times
After creating report I published report on iis and it's successfully published.

Starting Web Site Publishing...
Copying files from 'C:\Program Files (x86)\Seal Report\Web' to 'C:\inetpub\wwwroot\Seal Report'
Publishing Site on IIS...
Web Site has been published successfully.
Web Site Publishing terminated.

but when I integrate into MVC its gives the same error:
Unable to read the file 'C:\ProgramData\Seal Report Repository\Reports\Dashboard - Sales.srex'. There was an error reflecting type 'Seal.Model.Report'.

my code:
if (!CheckAuthentication()) return Content(_loginContent);
Repository repository = Repository.CreateFast();
Report reportToExecute = Report.LoadFromFile(@"C:\ProgramData\Seal Report Repository\Reports\Dashboard - Sales.srex", repository);
reportToExecute.WebExecutionGUID = Guid.NewGuid().ToString();
reportToExecute.ExecutionContext = ReportExecutionContext.WebReport;
reportToExecute.SecurityContext = WebUser;
reportToExecute.CurrentViewGUID = reportToExecute.ViewGUID;

//execute to output
if (!string.IsNullOrEmpty(outputGUID))
{
reportToExecute.OutputToExecute = reportToExecute.Outputs.FirstOrDefault(i => i.GUID == outputGUID);
reportToExecute.ExecutionContext = ReportExecutionContext.WebOutput;
if (reportToExecute.OutputToExecute != null) reportToExecute.CurrentViewGUID = reportToExecute.OutputToExecute.ViewGUID;
}

//execute with custom view
if (!string.IsNullOrEmpty(viewGUID)) reportToExecute.CurrentViewGUID = viewGUID;

ReportExecution execution = new ReportExecution() { Report = reportToExecute };
Session[reportToExecute.WebExecutionGUID] = execution;
int index = Request.Url.OriginalString.ToLower().IndexOf("initexecutereport");
if (index == -1) throw new Exception("Invalid URL");
reportToExecute.WebUrl = Request.Url.OriginalString.Substring(0, index);
repository.WebPublishFolder = Path.Combine(Request.PhysicalApplicationPath, "temp");
repository.WebApplicationPath = Path.Combine(Request.PhysicalApplicationPath, "bin");
if (!Directory.Exists(repository.WebPublishFolder)) Directory.CreateDirectory(repository.WebPublishFolder);
FileHelper.PurgeTempDirectory(repository.WebPublishFolder);

reportToExecute.InitForExecution();
execution.RenderHTMLDisplayForViewer();
return Redirect(reportToExecute.WebTempUrl + Path.GetFileName(execution.Report.HTMLDisplayFilePath));


Error line is: Report reportToExecute = Report.LoadFromFile(@"C:\ProgramData\Seal Report Repository\Reports\Dashboard - Sales.srex", repository);
epf  
#4 Posted : Friday, November 24, 2017 2:40:00 PM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
The error comes from the Deserialization of the report...so it is strange,
you can look at the inner exception to have more detail.

check also on the web "an error reflecting type", there are a lot of answers.
sanyami  
#5 Posted : Monday, November 27, 2017 6:00:55 AM(UTC)
sanyami

Rank: Newbie

Groups: Registered
Joined: 11/20/2017(UTC)
Posts: 11
India

Thanks: 1 times
When I run Sample report its working fine but when I create a new report and publish the report after executing report it gives me following error:

Unable to read the file 'C:\ProgramData\Seal Report Repository\Reports\Company Directory.srex'.There is an error in XML document (72, 12).

Please give me any solution.

Edited by user Monday, November 27, 2017 6:47:09 AM(UTC)  | Reason: Not specified

epf  
#6 Posted : Monday, November 27, 2017 7:07:51 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
It looks like your document has be corrupted somewhere...
Check the XML generated in the file.
Users browsing this topic
Guest (3)
Similar Topics
Got Unexpected Exception -> Invalid URL (Bug Reports)
by emre 9/4/2015 7:28:22 AM(UTC)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.