我正在使用此代码设计报告。所以当我想保存我的模板时,我的应用程序崩溃了,我在终端中收到了这条消息:
目标进程在评估函数“Stimulsoft.Report.Mvc.StiNetCoreDesigner.DesignerEventResult”时退出,代码为 0 (0x00000000)。
我也收到“来自服务器的超时响应”。在控制台日志中。
我使用的是 dotnet core 3.1。
[HttpGet]
[GrantAuthorize("0")]
public IActionResult ReportDesigner(Guid id)
{
var reportTemplateModel = this.GetById(id);
var model = new StiNetCoreDesignerOptions()
{
Localization = "~/Content/Localization/fa.xml",
Actions =
{
GetReport = "GetDesignerReport",
CreateReport = "CreateReport",
DesignerEvent = "DesignerEvent",
SaveReport="SaveReport",
//SaveReportAs="SaveReport",
},
Appearance ={
//ReportDisplayMode=Stimulsoft.Report.Web.StiReportDisplayMode.Div,
ShowDialogsHelp=false,
//important
//ShowSystemFonts=false
},
FileMenu =
{
ShowSaveAs=false,
Visible=false
},
Dictionary =
{
//PermissionDataSources = Stimulsoft.Report.Web.StiDesignerPermissions.View,
//PermissionResources=Stimulsoft.Report.Web.StiDesignerPermissions.View
}
};
if (IsAjaxRequest) return PartialView(model);
return View(model);
}
[GrantAuthorize("0")]
public IActionResult GetDesignerReport(Guid id)
{
var reportTemplate = this.Service.GetById(id);
if (reportTemplate == null)
{
throw new Gamma.Core.Exceptions.GammaException(Localizer["Msg_NoDataFoundOrDeleted"], statusCode: Core.Exceptions.ErrorCodes.NoDataFound.GetHashCode());
}
StiReport report = new StiReport();
if (System.IO.File.Exists(System.IO.Path.Combine(_environment.WebRootPath, reportTemplate.FilePath)))
{
report.Load(StiNetCoreHelper.MapWebRootPath(this, reportTemplate.FilePath));
}
return StiNetCoreDesigner.GetReportResult(this, report);
}
[GrantAuthorize("0")]
public IActionResult CreateReport(Guid id)
{
var report = new StiReport();
DataSet data = new DataSet("Demo");
report.RegData(data);
report.Dictionary.Synchronize();
return StiNetCoreDesigner.GetReportResult(this, report);
}
[GrantAuthorize("0")]
public IActionResult SaveReport(Guid id)
{
try
{
var reportTemplateModel = this.Service.GetById(id);
if (reportTemplateModel == null)
{
throw new Gamma.Core.Exceptions.GammaException(Localizer["Msg_NoDataFoundOrDeleted"], statusCode: Core.Exceptions.ErrorCodes.NoDataFound.GetHashCode());
}
var report = new StiReport();
var requestParams = StiNetCoreDesigner.GetRequestParams(this);
var reportName = requestParams.Designer.FileName;
var filePath = $"reportTemplate/{reportName}";
reportTemplateModel.FilePath = filePath;
var rootpath = StiNetCoreHelper.MapWebRootPath(this, filePath);
report.Save(rootpath);
this.Service.Update(reportTemplateModel);
return StiNetCoreDesigner.SaveReportResult(this);
}
catch (Exception ex)
{
throw ex;
}
}
[GrantAuthorize("0")]
public IActionResult DesignerEvent()
{
return StiNetCoreDesigner.DesignerEventResult(this);
}