When I run my .net core app locally, via Visual Studio the reports work fine. They are generated like they are supposed to
but when I host the app on a server, nothing happens. I don't even get a console error or a warning.
This is my ConfigureServices in the Startup
public void ConfigureServices(IServiceCollection services) { services.Configure<IISServerOptions>(options => { options.AllowSynchronousIO = true; }); services.AddRazorPages().AddNewtonsoftJson(); // Configure dependencies for ReportsController. services.TryAddSingleton<IReportServiceConfiguration>(sp => new ReportServiceConfiguration { ReportingEngineConfiguration = ConfigurationHelper.ResolveConfiguration(sp.GetService<IWebHostEnvironment>()), HostAppId = "KarposReports", Storage = new FileStorage(), ReportSourceResolver = new UriReportSourceResolver( System.IO.Path.Combine(sp.GetService<IWebHostEnvironment>().WebRootPath, "ReportTemplate")) }); services.AddCors(o => o.AddDefaultPolicy(builder => { builder .WithOrigins("http://localhost:60024", "https://app.gdi.mk/", "Access-Control-Allow-Credentials") .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); })); services.AddControllersWithViews(); }
Here is the view, where my ReportViewer is. I tried with the standard serviceUrl variations "/api/reports" as well as "api/reports" as well as "~/api/reports".
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script><link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css" /><script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script><script src="~/js/bootstrap.min.js"></script><link href="~/css/bootstrap.min.css" rel="stylesheet" /><link href="https://kendo.cdn.telerik.com/2020.2.513/styles/kendo.common.min.css" rel="stylesheet" /><link href="https://kendo.cdn.telerik.com/2020.2.513/styles/kendo.default.min.css" rel="stylesheet" /><script src="https://kendo.cdn.telerik.com/2020.2.513/js/kendo.all.min.js"></script><!--If Kendo is used it should be added before the report viewer.--><script src="~/Reports/telerikReportViewer-14.1.20.513.min.js"></script><script src="~/Reports/telerikReportViewer.kendo-14.1.20.513.min.js"></script><script> window.rootUrl = '@Url.Content("~/")';</script><style> #reportViewer1 { position: absolute; left: 5px; right: 5px; top: 5px; bottom: 5px; overflow: hidden; font-family: Verdana, Arial; margin-left: 14%; display: none } #reportForm { margin-left: 16% } #loader { position: fixed; top: 50%; right: 50%; max-width: 20%; max-height: 20%; background-color: #fff; background-image: url('~/img/loading.gif'); background-repeat: no-repeat; background-position: center; z-index: 10000000; opacity: 0.4; filter: alpha(opacity=40); /* For IE8 and earlier */ }</style><img src="~/img/loading.gif" id="loader" style="display:none"/><link rel="stylesheet" href="https://js.arcgis.com/3.32/esri/css/esri.css"><script src="https://js.arcgis.com/3.32/"></script><script> var map; var imageUrl, imageLegendUrl; var minParc, fullP, sentScale, reportType, globalParcel; var mainReportParameters = {}; var mainReport; var documentType; require(["esri/map", "esri/config", "esri/dijit/Basemap", "esri/dijit/BasemapLayer", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/tasks/QueryTask", "esri/tasks/query", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/Color", "esri/graphic", 'esri/symbols/SimpleMarkerSymbol', 'dojo/_base/array', 'esri/geometry/Extent', "esri/dijit/Print", "esri/tasks/PrintTemplate", "dojo/dom", "esri/tasks/PrintTask", "esri/tasks/PrintParameters", "dojo/on", "dojo/domReady!"], function (Map, esriConfig, Basemap, BasemapLayer, ArcGISTiledMapServiceLayer, ArcGISDynamicMapServiceLayer, QueryTask, Query, SimpleFillSymbol, SimpleLineSymbol, Color, Graphic, SimpleMarkerSymbol, array, Extent, Print, PrintTemplate, dom, PrintTask, PrintParameters, on) { map = new Map("map", { basemap: "satellite", //For full list of pre-defined basemaps, navigate to http://arcg.is/1JVo6Wd center: [21.403316, 42.002183], zoom: 10 }); var secondLayer = new ArcGISDynamicMapServiceLayer("https://75.10.112.50:6443/arcgis/rest/services/karpos/Karpos_Vector_Izvodi/MapServer", { "opacity": 1 }); map.addLayer(secondLayer); map.on("load", selectRoute); function selectRoute() { console.log("Security patch #523532.12"); } } ); $(document).ready(function () { // on change - GET HOUSE NUMBER BY STREET changeStreet = function (_this) { var street = $("#streetNameID option:selected").val(); $("#houseNumberID").empty(); var houseNumLink = window.rootUrl + 'DUP/GetHouseNumberByStr?str=' + street; $.getJSON(houseNumLink, function (houseN) { $("#houseNumberID").append('<option ></option>'); $.each(houseN, function (index, value) { //console.log("value", value); $("#houseNumberID").append('<option value="' + value.kbr + '">' + value.kbr + '</option>'); }); }); } // on change - GET HOUSE NUMBER BY STREET // on change - GET BUILD PARCEL fillParcel = function () { var parcelURL = window.rootUrl + 'DUP/GetDUPbyID'; var input = ($("#buildParcelID").val()).trim(); var regExp = input.match(/^[0-9][0-9]?#[0-9][\.0-9]*?#[0-9][\.0-9A-Za-z]*?$/); if (regExp != null) { var inputArray = input.split("#"); var dup = inputArray[0]; minParc = inputArray[1] + "." + inputArray[2]; fullP = inputArray[0] + "#" + inputArray[1] + "#" + inputArray[2]; var fullLink = parcelURL + "?id=" + dup; $.getJSON(fullLink, function (dup) { $.each(dup, function (index, value) { $("#DUPid").val(value.imE_MAK); $("#odlukaDup").val(value.odluka); $("#datumDup").val(value.datumdones); }); }); $.ajax({ url: window.rootUrl + 'DUP/GetGradeznaParcela', type: "POST", dataType: 'json', //headers: { // 'Access-Control-Allow-Credentials': true, // 'Access-Control-Allow-Origin': '*', // 'Access-Control-Allow-Methods': 'GET', // //'Access-Control-Allow-Headers': 'application/json', //}, data: "id=" + fullP, success: function (data) { $("#klasaNam").val(data[0].klasa_nam); $("#urbanistickaParcela").val(data[0].mod_id + "." + data[0].brparc); $("#povrsinaUrbParc").val(data[0].pparc); $("#povrsinaGabarit").val(data[0].pobjgab); $("#procentIzgradenost").val(data[0].procizgr); $("#maxIzgPovr").val(data[0].prazmax); $("#koefIsko").val(data[0].koefisko); $("#maxDozH").val(data[0].maxh); var brMesta = data[0].parkmest; var temp = brMesta.split('.'); $("#brParkingMesta").val(temp[0]); }, error: function (err) { console.log(err); } }); } else { alert("Внесете точна градежна парцела"); } } // on change - GET BUILD PARCEL // on change radio button - SHOW SINGLE PAGE OR DOUBLE PAGE REPORT additionalData = function () { var rep = $("input[name='reportButton']:checked").val(); if (rep == 1) { $(".secondReportPage").hide(); } else { $(".secondReportPage").show(); } } // on change - SHOW SINGLE PAGE OR DOUBLE PAGE REPORT // - button for report printing clicks = function (e) { $("#loader").show(); $("#reportForm").hide(); var scaleDiv = $("#scale option:selected").val(); if (scaleDiv == 1) { sentScale = 1000; } else { sentScale = 2500; } reportType = $("input[name='reportButton']:checked").val(); globalParcel = ($("#buildParcelID").val()).trim(); printMap(); } // - button for report printing function printMap() { require(["dojo/on", "esri/config", "esri/tasks/QueryTask", "esri/tasks/query", 'esri/symbols/SimpleMarkerSymbol', "esri/symbols/SimpleLineSymbol", "esri/Color", 'esri/geometry/Extent', "esri/tasks/PrintTask", "esri/tasks/PrintParameters", "esri/tasks/PrintTemplate", "dojo/domReady!"], function (on, esriConfig, QueryTask, Query, SimpleMarkerSymbol, SimpleLineSymbol, Color, Extent, PrintTask, PrintParameters, PrintTemplate) { console.log("globalParcel :: " + globalParcel + " reportType :: " + reportType + " globalScale :: " + sentScale); var queryTask = new QueryTask("https://75.10.112.50:6443/arcgis/rest/services/karpos/Karpos_Vector_Izvodi/MapServer/1"); var query = new Query(); query.where = "code ='" + globalParcel + "'"; query.outSpatialReference = map.spatialReference; query.returnGeometry = true; query.outFields = ["*"]; queryTask.execute(query).then(zoomToRoute); // ZOOM TO ROUTE function zoomToRoute(features) { var map = this.map; map.graphics.clear(); var pointSymbolNew = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 255, 255]), 1), new Color([255, 0, 127, 1])); var selectedFeature = features.features; selectedFeature[0].setSymbol(pointSymbolNew); map.graphics.add(selectedFeature[0]); map.setScale(sentScale); map.centerAt(selectedFeature[0].geometry); setTimeout(printImage, 1000); } // ZOOM TO ROUTE // SET COOKIE function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toGMTString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } // SET COOKIE // PRINT IMAGE function printImage() { var printTask; var params = new PrintParameters(); if (sentScale == 1000) { printTask = new PrintTask('https://75.10.112.50:6443/arcgis/rest/services/karpos/Print_Karpos/GPServer/Export%20Web%20Map'); params.map = map; } else if (sentScale == 2500) { printTask = new PrintTask('https://75.10.112.50:6443/arcgis/rest/services/karpos/Print_Karpos/GPServer/Export%20Web%20Map'); params.map = map; } var template = new PrintTemplate(); template.format = 'JPG'; template.layout = 'MAP_ONLY'; template.preserveScale = false; params.template = template; printTask.execute(params).then(printResult); } // PRINT IMAGE // PRINT RESULT function printResult(evt) { console.log("printResult start") imageUrl = evt.url; setCookie('imageUrl', imageUrl, 1); if (reportType == 1) { console.log("reportType == 1") printReport(); } if (reportType == 2) { console.log("reportType == 2") var printTaskLegend; var printPars = new PrintParameters(); printPars.map = map; if (sentScale == 1000) { console.log("sentScale == 1000") printTaskLegend = new PrintTask('https://75.10.112.50:6443/arcgis/rest/services/karpos/Print_Karpos/GPServer/Export%20Web%20Map'); printPars.map = map; } else if (sentScale == 2500) { console.log("sentScale == 2500") printTaskLegend = new PrintTask('https://75.10.112.50:6443/arcgis/rest/services/karpos/Print_Karpos/GPServer/Export%20Web%20Map'); printPars.map = map; } var template = new PrintTemplate(); template.format = 'JPG'; template.layout = 'Print_legend_included'; template.preserveScale = true; printPars.template = template; //printTaskLegend.execute(printPars, printImageLegend); printTaskLegend.execute(printPars).then(printImageLegend); console.log("printTaskLegend.execute") console.log("printResult end") } } // PRINT RESULT // PRINT IMAGE LEGEND function printImageLegend(evt) { console.log("printImageLegend") imageLegendUrl = evt.url; setCookie('imageLegendUrl', imageLegendUrl, 1); printReport(); console.log("printImageLegend.end") } // PRINT IMAGE LEGEND }); } // - read cookie function readCookie(name) { // hellper function to read a cookie var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; } // - read cookie // PRINT REPORT FUNCTION function printReport() { if (reportType == 1) { documentType = "KarposSingleReportFINAL.trdp" mainReportParameters = { "reportNumberID_par": $("#reportNumberID").val(), "dateID_par": $("#dateID").val(), "planNumberID_par": $("#planNumberID").val(), "dupDescription_par": $("#DUPid").val(), "dupDecision_par": $("#odlukaDup").val(), "dupDate_par": $("#datumDup").val(), "klasaNamena_par": $("#klasaNam").val(), "buildParcel_par": minParc, "street_par": $("#streetNameID").val(), "houseNumber_par": $("#houseNumberID option:selected").val(), "municipality_par": $("#KBRid").val(), "detailsDocument_par": $("#detailsDocumentID").val(), "municipalParcel_par": $("#municipalParcelID").val(), "scale_par": $("#scale option:selected").text(), "imageUrl_par": readCookie("imageUrl") } console.log("single documentType!!!", documentType) console.log("singleParameters!!!", mainReportParameters) } if (reportType == 2) { console.log("reporttype2 documentType!!!") documentType = "KarposDoubleReport.trdp" mainReportParameters = { "reportNumberID_par": $("#reportNumberID").val(), "dateID_par": $("#dateID").val(), "planNumberID_par": $("#planNumberID").val(), "dupDescription_par": $("#DUPid").val(), "dupDecision_par": $("#odlukaDup").val(), "dupDate_par": $("#datumDup").val(), "klasaNamena_par": $("#klasaNam").val(), "buildParcel_par": minParc, "street_par": $("#streetNameID").val(), "houseNumber_par": $("#houseNumberID option:selected").val(), "municipality_par": $("#KBRid").val(), "detailsDocument_par": $("#detailsDocumentID").val(), "municipalParcel_par": $("#municipalParcelID").val(), "scale_par": $("#scale option:selected").text(), "urbanistickaParc_par": $("#urbanistickaParcela").val(), "povrsinaUrbParc_par": $("#povrsinaUrbParc").val() + " м2", "povrsinaGabarit_par": $("#povrsinaGabarit").val() + " м2", "procentIzgradenost_par": $("#procentIzgradenost").val() + "%", "maxIzgPovr_par": $("#maxIzgPovr").val() + " м2", "koefIsko_par": $("#koefIsko").val(), "maxDozH_par": $("#maxDozH").val() + " м", //"maxHSleme_par": maxSleme, "brojParkingMesta_par": $("#brParkingMesta").val(), "drUslovi_par": $("#miscelanousID").val(), "soobUslovi_par": $("#trafficConditionsID").val(), "imageUrl_par": readCookie("imageUrl"), "imageLegendUrl_par": readCookie("imageLegendUrl") } } $("#reportViewer1").show(); $("#loader").hide(); $("#reportViewer1").telerik_ReportViewer({ serviceUrl: "/api/reports/", reportSource: { report: documentType, parameters: mainReportParameters }, viewMode: telerikReportViewer.ViewModes.INTERACTIVE, scaleMode: telerikReportViewer.ScaleModes.SPECIFIC, scale: 1.0, enableAccessibility: true, sendEmail: { enabled: false }, ready: function () { //this.refreshReport(); }, }); } // PRINT REPORT FUNCTION // onPageLoad - GET STREETS var url = window.rootUrl + 'DUP/GetAllStreets'; $.getJSON(url, function (streets) { $("#streetNameID").append('<option></option>'); $.each(streets, function (index, value) { $("#streetNameID").append('<option value="' + value.Ime_1251 + '">' + value.Ime_1251 + '</option>'); }); }); // onPageLoad - GET STREETS // onPageLoad - GET MUNICIPALITY var municipalityURL = window.rootUrl + 'DUP/GetAllKatastarskiOpstini'; $.getJSON(municipalityURL, function (mun) { $("#KBRid").append('<option></option>'); $.each(mun, function (index, value) { //console.log("value", value); $("#KBRid").append('<option value="' + value.ime_1251 + '"> </option>'); }); }); // onPageLoad - GET MUNICIPALITY });</script><div> <div> <div class="sidebar" data-color="purple" data-background-color="white" <img src="~/img/sidebar-1.jpg" /> <!-- Tip 1: You can change the color of the sidebar using: data-color="purple | azure | green | orange | danger" Tip 2: you can also add an image using data-image tag --> <div class="logo"> Општина Карпош </a> </div> <div class="sidebar-wrapper"> <ul class="nav"> <li class="nav-item active "> <a class="nav-link" asp-controller="Home" asp-action="Index"> <i class="fa fa-plus-circle" aria-hidden="true"></i> <span>Почетна</span> </a> </li> <li class="nav-item "> <a class="nav-link" asp-controller="DUP" asp-action="PrintReport"> <i class="fa fa-plus-circle" aria-hidden="true"></i> <span>Подготви извештај</span> </a> </li> <li class="nav-item "> <a class="nav-link" href="https://www.google.com/maps"> <i class="material-icons">content_paste</i> <p>ГИС Прегледник</p> </a> </li> </ul> </div> </div> </div> <div id="reportForm"> <div class="form-group row" onchange="additionalData()"> <div class="col-md-6"> <div class="checkbox"> <label><input id="reportButton" name="reportButton" type="radio" value="1" />Извод на една страна</label> </div> </div> <div class="col-md-6"> <div class="checkbox"> <label><input id="reportButton" name="reportButton" type="radio" value="2" />Извод на две страни</label> </div> </div> <p style="color:red; display:inline" id="radiorequired"></p> </div> <div class="form-group"> <label for="reportNumber">Број</label> @Html.ValidationMessageFor(model => model.reportNumber, "*", new { @class = "text-danger" }) @Html.TextBoxFor(model => model.reportNumber, new { id = "reportNumberID", @class = "form-control" }) </div> <div class="form-group"> <label for="date">Датум</label> @Html.TextBoxFor(model => model.date, "{0:yyyy-MM-dd}", new { id = "dateID", @type = "date", @class = "form-control" }) </div> <div class="form-group"> <label for="planNumber">Извод од план број</label> @Html.TextBoxFor(model => model.planNumber, new { id = "planNumberID", @class = "form-control" }) </div> <div class="form-group"> <label for="">Размер</label> <select class="form-control" id="scale" name="scale"> <option value="1" selected>1:1000</option> <option value="2">1:2500</option> </select> </div> <div class="form-group"> <label for="buildParcel">Градежна парцела</label> @Html.TextBoxFor(model => model.buildParcel, new { @name = "buildParcel", id = "buildParcelID", @class = "form-control", onchange = "fillParcel()" }) </div> <div class="form-group"> <label for="DUP">ДУП</label> @Html.TextBoxFor(model => model.DUP, new { id = "DUPid", @class = "form-control" }) </div> <div class="form-group"> <label for="streetName">Улица</label> @Html.DropDownListFor(model => model.streetName, ViewBag.streetName as SelectList, "Одберете...", new { @name = "streetName", id = "streetNameID", onchange = "changeStreet(this)" }) </div> <div class="form-group"> <label for="houseNumber">Куќен број</label> @Html.DropDownListFor(model => model.houseNumber, ViewBag.houseNumber as SelectList, "Одберете...", new { @name = "houseNumber", id = "houseNumberID" }) </div> <div class="form-group"> <label for="KBR">Катастарска општина</label> @Html.DropDownListFor(model => model.KBR, ViewBag.KBR as SelectList, "Одберете...", new { @name = "KBR", id = "KBRid" }) </div> <div class="form-group"> <label for="municipalParcel">Катастарска парцела</label> @Html.TextBoxFor(model => model.municipalParcel, new { id = "municipalParcelID", @class = "form-control" }) </div> <div class="form-group"> <label for="detailsDocument">Детален лист</label> @Html.TextBoxFor(model => model.detailsDocument, new { id = "detailsDocumentID", @class = "form-control" }) </div> <div class="secondReportPage"> <div class="form-group"> <label for="trafficConditions">Сообраќајни услови</label> @Html.TextBoxFor(model => model.trafficConditions, new { id = "trafficConditionsID", @class = "form-control", placeholder = "Паркирање во рамките на сопствена парцела" }) </div> <div class="form-group"> <label for="miscelanous">Други услови</label> @Html.TextBoxFor(model => model.miscelanous, new { id = "miscelanousID", @class = "form-control", placeholder = "Овој извод е основа за изработка на основен проект/архитектонско - урбанистички проект, кој пак е потребен во постапката за добивање одобрение за градење. Изработката на проектантската документација да е во согласност со законската и подзаконската регулатива од областа." }) </div> </div> <div> <button id="reportBtn" class="btn btn-default" onclick="clicks()">Подготви извештај</button> </div> <div style="display:none"> <label>Одлука</label> <input id="odlukaDup" /> <br /> <label>Даtум </label> <input id="datumDup" /> <br /> <label>Класа намена </label> <input id="klasaNam" /> <br /> <label>Број на урбанистичка парцела </label> <input id="urbanistickaParcela" /><br /> <label>Површина на урбанистичка парцела </label> <input id="povrsinaUrbParc" /> <br /> <label>Површина на габарит </label> <input id="povrsinaGabarit" /> <br /> <label>Процент на изграденост </label> <input id="procentIzgradenost" /> <br /> <label>Максимална изградена површина </label> <input id="maxIzgPovr" /> <br /> <label>Коефициент на искористеност </label> <input id="koefIsko" /> <br /> <label>Максимална дозволена висина на венец </label> <input id="maxDozH" /> <br /> <label>Број на паркинг места </label> <input id="brParkingMesta" /> <br /> </div> <div id="map"></div> </div></div><div id="reportViewer1" class="k-widget"> loading...</div>I have no errors in console, in the picture attached.
Anyone has any idea why would it generate the reports just fine locally via Visual Studio and when I host the app it doesn't generate /print the reports?