Reporting Services提供了非常丰富的接口和扩展,给开发人员以极大的施展空间.
期间却也常有些莫名其妙的问题,今天就来搞定这臭名昭著的"图形/图表无法显示的'rsStreamNotFound'":
流程:
Reporting Services产生的是PNG图片.当IE Client请求报表时,
1)创建Session,
2)返回HTML
3)根据HTML,在该Session内创建新请求,已请求后续的流. (Render报表时,一定要测试RenderStream为空方可中止).
问题:
1)在本机通过 localhost , machine name 访问正常
2)在网络内通过 IP访问正常.
3)在本机通过IP访问,图表显示红叉
解决方案:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=114614&SiteID=1
I discovered that images in report rendering rely on session and cookies.
When you have and underscore "_" in the server name, this may cause some session problems.
So I update the field UseSessionCookies to 'False' in the ConfigurationInfo table, in the RS Database. The images are now displayed!
即:
UseSessionCookies | Indicates whether the report server should use session cookies when communicating with client browsers. The default value is true. |
ReportServices rs=new ReportServices();
rs.InitReport(strUser,strPassword,strDomain);
Property setProp = new Property();
setProp.Name = "UseSessionCookies";
setProp.Value = null;
Property[] props = new Property[1];
props[0] = setProp;
props=rs.rs.GetSystemProperties(props);
if(props.Length>0 && props[0].Value.Equals("true"))
{
props[0].Value="false";
rs.rs.SetSystemProperties(props);
}
return rs;