【茶包射手專橺】Reporting Service圖表無法顯示
同事回報一個問題,在測試台檢視Reporting Service報表時,應該顯示長條圖、圓餅圖的地方出現一個大叉叉,同一程式在正式台則一切正常。
首先出場的工具是Fiddler,很快就抓到在GET圖檔的Request有以下錯誤:
ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.StreamNotFoundException: The stream cannot be found. The stream identifier that is provided to an operation cannot be located in the report server database. ; (找不到資料流。報表伺服器資料庫中找不到提供給作業的資料流識別項。)
Info: Microsoft.ReportingServices.Diagnostics.Utilities.StreamNotFoundException: The stream cannot be found. The stream identifier that is provided to an operation cannot be located in the report server database. (找不到資料流。報表伺服器資料庫中找不到提供給作業的資料流識別項。)
用rsStreamNotFound當關鍵字,我Google到一篇文章,說明這可能與Cookie有關。我仔細看了一下,有問題的網頁是用ASPX在其中包含Frame指向Reporting Service報表所在的httq://192.168.1.1/ReportServer?... URL。
依我多年吃餅乾的經驗,這種情境很符合3rd Party Cookie被禁用的條件,Check了一下IE的工具列,果然有個被禁止的眼睛Icon(參見這篇文件關於Cookie Filtering的說明)。點開後確認一個來自httq://192.168.1.1/ReportServer的Cookie被Block掉了,在正式台上,Reporting Service報表主機的URL用的是Machine-Name所以沒問題,這印證了先前找到那篇文章所說的Cookie Issue。
為了進一步驗證真的是Cookie問題,我將httq://192.168.1.1設為IE的被信任網站,報表中的圖表就可順利顯示,宣布破案。
解決方式有二: 1) 將Reporting Service Server的IP加為IE的信任站台(Trusted Sites)解決Cookie被阻擋的問題,2) 連至Reporting Service的URL不要用IP,改用機器名稱(當然,要確保名稱解析是OK的),利用Local Intranet安全區域避開Cookie阻擋問題。我個人建議使用後者。