diff --git a/Vrh.OneReport/Properties/AssemblyInfo.cs b/Vrh.OneReport/Properties/AssemblyInfo.cs
index 4b628cd..3e0e897 100644
--- a/Vrh.OneReport/Properties/AssemblyInfo.cs
+++ b/Vrh.OneReport/Properties/AssemblyInfo.cs
@@ -32,6 +32,6 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("4.5.1.0")]
-[assembly: AssemblyFileVersion("4.5.1.0")]
-[assembly: AssemblyInformationalVersion("4.5.1")]
\ No newline at end of file
+[assembly: AssemblyVersion("4.5.2.0")]
+[assembly: AssemblyFileVersion("4.5.2.0")]
+[assembly: AssemblyInformationalVersion("4.5.2")]
\ No newline at end of file
diff --git a/Vrh.OneReport/ReportService.cs b/Vrh.OneReport/ReportService.cs
index e3f4e61..60d6da8 100644
--- a/Vrh.OneReport/ReportService.cs
+++ b/Vrh.OneReport/ReportService.cs
@@ -849,20 +849,13 @@ namespace Vrh.OneReport
using (var reportViewer = new ReportViewer { ProcessingMode = ProcessingMode.Local })
{
reportViewer.LocalReport.ReportPath = PrepareRdl(this.Report, autopurgeparameters: this.Report.AutoPurge);
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Ez a rész azért kell ide, mert egyébként nem web-es környezetben (az iSchedulerMonitor-ból való hívás esetén)
- // itt exception jön a reportViewer.Dispose()-ból annak ellenére, hogy az rr tartalmazza a byte sorozatot?!
- // A reportViewer HttpContext-et igényel, és ezzel a kódrésszel kell ezt megteremteni.
- if (System.Web.HttpContext.Current == null)
+ SetHttpContextCurrent(1);
+ foreach (var dataset in this.Report.Datasets)
{
- System.Web.HttpContext.Current = new System.Web.HttpContext(
- new System.Web.HttpRequest(System.IO.Path.GetRandomFileName(), "https://www.stackoverflow.com", string.Empty),
- new System.Web.HttpResponse(System.IO.TextWriter.Null)
- );
+ if (dataset.Type == DatasetTypes.DataPlugin || dataset.Type == DatasetTypes.SQLTextPlugin) SetHttpContextCurrent(2);
+ var ds = CreateOneDataSource(dataset, this.Report.Parameters);
+ reportViewer.LocalReport.DataSources.Add(ds);
}
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
- foreach (var dataset in this.Report.Datasets) { reportViewer.LocalReport.DataSources.Add(CreateOneDataSource(dataset,this.Report.Parameters)); }
reportViewer.LocalReport.SetParameters(GetReportParameters());
string format;
@@ -885,6 +878,49 @@ namespace Vrh.OneReport
);
}
}
+
+ ///
+ /// Web-es és nem web-es környezetben való futtatás esetére az exception-ök elkerülése érdekében szükséges hívások.
+ /// NEM TELJESEN TISZTA A FUNKCIÓJUK!!!!
+ ///
+ ///
+ /// mode==1
+ /// Ez a rész azért kell ide, mert egyébként nem web-es környezetben (az iSchedulerMonitor-ból való hívás esetén)
+ /// itt exception jön a reportViewer.Dispose()-ból annak ellenére, hogy az rr tartalmazza a byte sorozatot?!
+ /// A reportViewer HttpContext-et igényel, és ezzel a kódrésszel kell ezt megteremteni.
+ /// mode==2
+ /// Ez a rész azért kell ide, mert egyébként a Hangfire-ral együttműködve hibára megy a plugin hívás a dbcontext használatakor
+ /// "The virtual path '/' maps to another application, which is not allowed."
+ /// exception-nal
+ ///
+ private static void SetHttpContextCurrent(int mode)
+ {
+ if (mode==1)
+ {
+ if (System.Web.HttpContext.Current == null)
+ {
+ System.Web.HttpContext.Current = new System.Web.HttpContext(
+ new System.Web.HttpRequest(System.IO.Path.GetRandomFileName(), "https://www.stackoverflow.com", string.Empty),
+ new System.Web.HttpResponse(System.IO.TextWriter.Null)
+ );
+ }
+ }
+ if (mode == 2)
+ {
+ string urlroot = null;
+ if (System.Web.HttpContext.Current == null) { urlroot = "http://localhost"; }
+ else
+ {
+ var rq = System.Web.HttpContext.Current.Request;
+ urlroot = rq.Url.GetLeftPart(UriPartial.Authority) + rq.ApplicationPath;
+ }
+ System.Web.HttpContext.Current = new System.Web.HttpContext(
+ new System.Web.HttpRequest("", urlroot, string.Empty),
+ new System.Web.HttpResponse(System.IO.TextWriter.Null)
+ );
+ }
+ }
+
#endregion ReportToByteArray private method
#region PrepareRdl
--
libgit2 0.21.2