Deploying Stimulsoft.Reports.Web.NetCore 2019.3.5 on IIS10

Stimulsoft Reports.WEB discussion
Post Reply
yoab
Posts: 5
Joined: Wed Sep 11, 2019 2:26 pm

Deploying Stimulsoft.Reports.Web.NetCore 2019.3.5 on IIS10

Post by yoab »

Hello,
I have developed a few reports using .net core 2.2 web and all is working fine on my localhost, as soon as I deploy to IIS10 on Windows server 2016 standard, the reports do not show, no error is logged and every single other part of the application works perfectly. I tried the "Publish" version and as long as its on localhost all is working well but deployment on IIS shows nothing and no error message. I have even tried a bare bones solution and after deployment it is the same behaviour. I see no spinner, no indication that the reportviewer is even trying to render and no error message. I strongly believe this must be an IIS issue and I have tried all manners of scenarios turning features on/off to no avail for over 3 days now. Please find attached my sample test project and I am a licensed user.
Attachments
Test.7z
(869.17 KiB) Downloaded 132 times
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Deploying Stimulsoft.Reports.Web.NetCore 2019.3.5 on IIS10

Post by Lech Kulikowski »

Hello,

We need some time to investigate the issue. We will let you know about the result.

Thank you.
emanuelv
Posts: 20
Joined: Fri Sep 13, 2019 5:46 pm

Re: Deploying Stimulsoft.Reports.Web.NetCore 2019.3.5 on IIS10

Post by emanuelv »

I may have a similar issue and it may be related to the requestUrl and requestAbsoluteUrl variables. I'm using the .NetCore packages with a Vue.js front end (published the report from the Designer as .NET Core with Angular since they are similar). On localhost, everything is fine, but when I deploy it, our server deploys our project to a custom URL similar to this: https://myserver.mydomain.com/MyCustomProject/.

The sample .NET Core Stimulsoft project sets up [Route("api/viewer")] in ViewerController.cs. So I import this in my script as such:

Code: Select all

<script src="~/api/viewer" type="text/javascript"></script>
The problem is that when I go to https://myserver.mydomain.com/MyCustomP ... api/viewer, at the bottom where requestAbsoluteUrl is set, it is set to https://myserver.mydomain.com/api/viewer instead of https://myserver.mydomain.com/MyCustomProject/api/viewer.

I verified in my network tools that this is indeed where it's trying to go when it tries to call https://myserver.mydomain.com/api/viewe ... n=2019.3.5. It doesn't seem to be using the MyCustomProject part. I've tried several ways to override the requestUrl and requestAbsoluteUrl parameters but have not had much luck.

My setup is similar to the default publish options from the Designer:

Code: Select all

// This is stimulsoft.component.ts

// Setting the required options on the client side
this.options = new Stimulsoft.Viewer.StiViewerOptions();
//this.options.height = "650px";

this.viewer = new Stimulsoft.Viewer.StiViewer(this.options, 'StiViewer', false);
this.viewer.renderHtml("viewer");

Code: Select all

// This is ViewerController.cs
	[Produces("application/json")]
	[Route("api/viewer")]
	public class ViewerController : Controller
	{
		[HttpGet]
		public IActionResult Get()
		{
			// Setting the required options on the server side
			/*var requestParams = StiNetCoreViewer.GetRequestParams(this);
			if (requestParams.Action == StiAction.Undefined)
			{
				var options = new StiNetCoreViewerOptions();

				return StiNetCoreViewer.GetScriptsResult(this, options);
			}*/

			return StiNetCoreViewer.ProcessRequestResult(this);
		}

		[HttpPost]
		public IActionResult Post()
		{
			var requestParams = StiNetCoreViewer.GetRequestParams(this);
			if (requestParams.Component == StiComponentType.Viewer)
			{
				switch (requestParams.Action)
				{
					case StiAction.GetReport:
						return GetReport();
				}
			}

			return StiNetCoreViewer.ProcessRequestResult(this);
		}

		// ---

		public IActionResult GetReport()
		{
			var report = new StiReport();
			var path = StiNetCoreHelper.MapPath(this, "Reports/Job_History_Report.mrt");
			report.Load(path);

			return StiNetCoreViewer.GetReportResult(this, report);
		}
	}
I'm sure I'm just missing something simple that I'm not seeing.
yoab
Posts: 5
Joined: Wed Sep 11, 2019 2:26 pm

Re: Deploying Stimulsoft.Reports.Web.NetCore 2019.3.5 on IIS10

Post by yoab »

Thank you Lech, I am anxiously waiting
yoab
Posts: 5
Joined: Wed Sep 11, 2019 2:26 pm

Re: Deploying Stimulsoft.Reports.Web.NetCore 2019.3.5 on IIS10

Post by yoab »

Hi emmanuelv,
I tried playing around with relativeurl, tried both true and false but I still get the same problem

@using Stimulsoft.Report.Web
@using Stimulsoft.Report.Mvc

@Html.StiNetCoreViewer(new StiNetCoreViewerOptions()
{
Server =
{
Controller= "Home",
RequestTimeout = 600,
UseRelativeUrls = false
},
Actions =
{
GetReport = "GetReport",
ViewerEvent = "ViewerEvent"
},
Theme = StiViewerTheme.SimpleGray
})


I am also convinced it is a simple setting/configuration property but cannot seem to lay a hold on it
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Deploying Stimulsoft.Reports.Web.NetCore 2019.3.5 on IIS10

Post by Lech Kulikowski »

Hello,

We tested your project on IIS server Win Server 2016, and reproduced the error. Then, in the Web.config file, we turned on application debugging and found that the report generator could not find the report template file (Report.mrt) that had not been copied. After copying the file, everything worked as required.

Also, please check that on the server is installed last version NET Core SDK 2.2

Thank you.
Attachments
photo_2019-09-16_09-07-24.jpg
photo_2019-09-16_09-07-24.jpg (87.27 KiB) Viewed 3003 times
emanuelv
Posts: 20
Joined: Fri Sep 13, 2019 5:46 pm

Re: Deploying Stimulsoft.Reports.Web.NetCore 2019.3.5 on IIS10

Post by emanuelv »

Hello Lech,

Thank you so much for your response. However, I think my issue is slightly different. I have found a very quick way to reproduce the issue. As an example, I am using the SimpleList demo (https://demo.stimulsoft.com/#Net/SimpleList). To run it locally, I published it from the Designer without making any changes to it using the .NET Core and Angular configuration. Running it in Visual Studio and debugging it in IIS Express within Visual Studio works fine. However, it breaks when I make this change:
- Right-click on the NetCoreAngularApplication project in the solution explorer.
- Click on Properties.
- In the Properties window that comes up, on the left side menu, click on Debug.
- Under Web Server Settings at the bottom, the App URL is set to "http://localhost:50754". Change this to anything different like "http://localhost:50754/testsite"
- Run it with IIS Express again. It will deploy the site to http://localhost:50754/testsite. However, when you navigate to the Stimulsoft Report section on the side menu of the webpage, the report does not display. Looking at the debug tools, it is trying to load http://localhost:50754/api/viewer?... from the base URL but it is ignoring the "testsite" portion of the URL. So this is throwing a 404 error on /api/viewer/ itself because http://localhost:50754/api/viewer cannot be found because it really should be http://localhost:50754/testsite/api/viewer.

Is there a way to make it not try to load /api/viewer/ from the base URL but rather the relative URL? I tried adding UseRelativeUrls=true to the Server object of the StiNetCoreViewerOptions() but that did not seem to work. Some of our sites are deployed to URLs similar to this where they do not live in the base URL, but rather more of a sub location. Again, I'm sure it's a very simple configuration flag, but I cannot seem to find it.

Thanks again!
Attachments
2019-09-16 09_39_16-Window.png
2019-09-16 09_39_16-Window.png (5.59 KiB) Viewed 3000 times
yoab
Posts: 5
Joined: Wed Sep 11, 2019 2:26 pm

Re: Deploying Stimulsoft.Reports.Web.NetCore 2019.3.5 on IIS10

Post by yoab »

Hello Lech,

After realizing you did nothing new that I hadn't already tried, I have uninstalled IIS and reinstalled it. All is perfect now Thank you.
Unfortunately I do not know what was causing the issue but a fresh installation of IIS10 with all default values solved my problem

Thanks again
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Deploying Stimulsoft.Reports.Web.NetCore 2019.3.5 on IIS10

Post by Lech Kulikowski »

Hello,

Thank you for the information.

Thank you.
Post Reply