Di recente mi è capitato un
errore su una macchina di sviluppo con
SharePoint 2016 onprem e
Reporting Services installato in
integrata.
L'
errore era sulla pagina con il ReportViewer, ovvero non veniva più visualizzata correttamente rendendo inusabile il report.
La stessa configurazione in ambiente di produzione funzionava correttamente, anche aggiornamento al
Service Pack 2 di
SQL Server e un successivo SharePoint Configuration Wizard,
non ha risolto niente.
La pagina del report si mostrava come in questa immagine
Errore di rendering Dopo una verifica con la
developer toolbar era chiaro che non venivano scaricate alcune risorte
CSS e
JavaScript, queste ritornavano uno stato
canceled o
HTTP 404 (Not Found).
In console veniva mostrato anche questo errore
Refused to apply style from '<URL>' because its MIME type () is not a supported stylesheet MIME type, and strict MIME checking is enabled.
e questo causato dal mancato caricamento dei
JavaScriptUncaught Sys.ArgumentUndefinedException: Sys.ArgumentUndefinedException: Value cannot be undefined.
Le risorse
CSS ritornavano uno stato 'canceled
https://sp2016/Reserved.ReportViewerWebPart.axd?OpType=Resource&Version=13.0.5026.0&Name=Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html5Toolbar.css
https://sp2016/Reserved.ReportViewerWebPart.axd?OpType=Resource&Version=13.0.5026.0&Name=Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.jqueryui.min.css
https://sp2016/Reserved.ReportViewerWebPart.axd?OpType=Resource&Version=13.0.5026.0&Name=Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html5Renderer.css
mentre quelle JavaScript ritornavano not found
(404)
https://sp2016/Reserved.ReportViewerWebPart.axd?OpType=Resource&Version=13.0.5026.0&Name=Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.jquery.min.js
https://sp2016/Reserved.ReportViewerWebPart.axd?OpType=Resource&Version=13.0.5026.0&Name=Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.jqueryui.min.js
https://sp2016/Reserved.ReportViewerWebPart.axd?OpType=Resource&Version=13.0.5026.0&Name=Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html5Renderer.js
altre risorse di tipo immagine venivano caricate correttamente, come ad esempio
https://sp2016/Reserved.ReportViewerWebPart.axd?OpType=Resource&Version=13.0.5026.0&Name=Microsoft.Reporting.WebForms.Icons.SplitterHorizExpand.png
Dopo parecchie prove e controlli, dove tutto risultava corretto, l'unica discriminante, rispetto alla produzione funzionante, è risultata essere la modalità debug
impostata su true
nell'ambiente di sviluppo e su false
in ambiente di produzione.
Il tutto si è risolto impostando a false
l'attributo debug
del tag compilation
nel file web.config''':
<compilation ... debug=”false” ...>