When working with the StiNetCoreViewer component, you can set the timeout for various operations — storing the report in the cache, server response, and query execution. The timeout setting is done using the component properties and report options.

 

 

CacheTimeout Property

Sets the time in minutes that the server will store the rendered report since the last action of the viewer. The default setting is 10 minutes.

 

Index.cshtml

...

@Html.StiNetCoreViewer(new StiNetCoreViewerOptions() {

Server =

{

CacheTimeout = 10

}

})

...

 

 

Using the cache will increase the speed of the report viewer. See the chapter Caching for more information.

 

 

RequestTimeout Property

Sets the time to wait for a response from the server in seconds, after which an error will be generated. The default value is 30 seconds. For big reports, it is recommended to increase this value.

 

Index.cshtml

...

@Html.StiNetCoreViewer(new StiNetCoreViewerOptions() {

Server =

{

RequestTimeout = 30

}

})

...

 

 

CommandTimeout Option

Also, for SQL data sources used in the report, you can specify the Query Timeout in seconds. The value of this property is stored in the report template for each SQL connection separately.

 

Below is an example of code that you may use to set the query timeout for the already created connection and data sources in the report.

 

Index.cshtml

...

@Html.StiNetCoreViewer(new StiNetCoreViewerOptions() {

Actions =

{

GetReport = "GetReport",

ViewerEvent = "ViewerEvent"

}

})

...

 

HomeController.cs

...

public IActionResult GetReport()

{

StiReport report = new StiReport();

report.Load(Server.MapPath("Report.mrt"));

((StiSqlSource)report.Dictionary.DataSources["DataSourceName"]).CommandTimeout = 1000;

 

return StiNetCoreViewer.GetReportResult(this, report);

}

 

public IActionResult ViewerEvent()

{

return StiNetCoreViewer.ViewerEventResult(this);

}

...