none
vs2005中使用reportingview控件调用rs2008报表,出现版本不兼容 RRS feed

  • 一般討論

  • 出现错误:

    尝试连接到报表服务器时失败。请检查连接信息,并检查报表服务器版本是否兼容。
    请求因 HTTP 状态 404 失败: Not Found。

    以下是前端代码:

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="CMFly.Web.Report._Default" %>

    <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <rsweb:ReportViewer ID="ReportViewer1" runat="server">
            </rsweb:ReportViewer>
        </div>
        </form>
    </body>
    </html>

    以下是后端程序代码:

    Partial Public Class _Default
        Inherits System.Web.UI.Page

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            With Me.ReportViewer1
                .ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
                .ShowToolBar = True
                .ShowParameterPrompts = True
                .ShowRefreshButton = True
                Dim lo_Credentials As New ReportServerCredentials
                .ServerReport.ReportPath = "AudioVideo/Using"
                .ServerReport.ReportServerUrl = New Uri(lo_Credentials.ReportServerUrl)
                .ServerReport.ReportServerCredentials = lo_Credentials
                .ServerReport.Refresh()
            End With       
        End Sub

        Private Class ReportServerCredentials
            Implements Microsoft.Reporting.WebForms.IReportServerCredentials

            ''' <summary>
            ''' 使用ReportServer的NT域
            ''' </summary>
            ''' <remarks></remarks>
            Private ms_Domain As String = ""

            ''' <summary>
            ''' 使用ReportServer的NT账号
            ''' </summary>
            ''' <remarks></remarks>
            Private ms_UserCode As String = "administrator"

            ''' <summary>
            ''' 使用ReportServer的NT账号密码
            ''' </summary>
            ''' <remarks></remarks>
            Private ms_Password As String = "pass@word1"

            ''' <summary>
            ''' 报表服务器Url
            ''' </summary>
            ''' <remarks></remarks>
            Public ReportServerUrl As String = String.Empty

            ''' <summary>
            '''
            ''' </summary>
            ''' <param name="authCookie"></param>
            ''' <param name="userName"></param>
            ''' <param name="password"></param>
            ''' <param name="authority"></param>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Public Function GetFormsCredentials(ByRef authCookie As System.Net.Cookie, ByRef userName As String, ByRef password As String, ByRef authority As String) As Boolean Implements Microsoft.Reporting.WebForms.IReportServerCredentials.GetFormsCredentials
                authCookie = Nothing
                userName = Nothing
                password = Nothing
                authority = Nothing
                Return False
            End Function

            ''' <summary>
            '''
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Public ReadOnly Property ImpersonationUser() As System.Security.Principal.WindowsIdentity Implements Microsoft.Reporting.WebForms.IReportServerCredentials.ImpersonationUser
                Get
                    Return Nothing
                End Get
            End Property

            ''' <summary>
            ''' 获取网络登录账号
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Public ReadOnly Property NetworkCredentials() As System.Net.ICredentials Implements Microsoft.Reporting.WebForms.IReportServerCredentials.NetworkCredentials
                Get
                    Return New System.Net.NetworkCredential(ms_UserCode, ms_Password, ms_Domain)
                End Get
            End Property

            ''' <summary>
            ''' 初始化
            ''' </summary>
            ''' <remarks></remarks>
            Public Sub New()
                ms_UserCode = "administrator"
                ms_Password = "autoyour"
                ms_Domain = "vjackiesql2008"
                ReportServerUrl = "http://vjackiesql2008/Reports"
                If String.IsNullOrEmpty(ReportServerUrl) Then ReportServerUrl = String.Format("http://{0}/ReportServer", System.Net.Dns.GetHostName())

                If Right(ReportServerUrl, 1) = "/" Then ReportServerUrl = ReportServerUrl.Substring(0, ReportServerUrl.Length - 1)
            End Sub

        End Class

    End Class

    • 已移動 ricoisme 2012年6月25日 上午 05:54 (從:資料庫與程式開發(SQL Server Development))
    • 已變更類型 璉璉Moderator 2012年7月7日 上午 09:38
    2012年6月25日 上午 04:18

所有回覆

  • 你跑錯區了,這不是SSRS問題

    網頁中註冊的reportviewer元件版本 Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0  是8.0,如果你想要顯示RS2008的話,請你註冊並參考9.0版本的reportviewer 元件

    下載

    http://www.microsoft.com/zh-tw/download/details.aspx?id=6576


    保證解答-微軟技術支援服務


    • 已編輯 ricoisme 2012年6月25日 上午 05:55
    2012年6月25日 上午 05:54
  • 1. 你是原本可以,然後SSRS 升級上去2008嗎? 還是連一開始拉RV就不行使用?

    2. 你可以先看一下SSTS的LogFile看是否有更進一步的錯誤訊息提供,預設路徑應該是 
    C:\Program Files\Microsoft SQL Server\ (SQL 版本)\Reporting Services\LogFiles

    此外可額外參考這篇說明
    Planning for Report Authoring and Report Deployment http://msdn.microsoft.com/en-us/library/dd207009.aspx

    你可以注意你的RDL Schema Versions 以及下面關於ReportViewer Controls對應的說明。

    2012年6月25日 上午 06:23
  • 如果是SQL Reporting Service 2008,你需要VS2010的ReportViewer

    ReportViewer Controls (Visual Studio) in VS2010

    Remote processing mode refers to report processing that is performed by a SQL Server 2008 or above Reporting Services report server. 

    ReportViewer Controls (Visual Studio) in VS2008

    Remote processing mode refers to report processing that is performed by a SQL Server 2005 Reporting Services report server.


    大家一齊探討、學習和研究,謝謝!
    MCSD, MCAD, MCSE+I, MCDBA, MCDST, MCSA, MCTS, MCITP, MCPD,
    MCT, Microsoft Community Star(TW & HK),
    Microsoft MVP for VB.NET since 2003
    My MSMVP Blog

    2012年6月26日 上午 01:55
  • 我在vs中引用过8.0,9.0,10.0控件版本一直都存在相同问题。

    另外,我也使用过vs2010开发工具,把.net框架完成3.5测试也都存在问题。

    我现在使用的操作系统是64位的win2008 r2版本。

    在本机中安装sql2008,配置rs2008也存在问题(配置不起来)

    目前rs2008是安装在win2003上。

    目前就差没有在vs2008上测试了

    谢谢各位回答,非常感谢,我先测试,有结果再和大家交流,谢谢!

    2012年6月26日 上午 04:04
  • 看我上面回复,谢谢!
    2012年6月26日 上午 04:05
  • 看我上面回复,谢谢!
    2012年6月26日 上午 04:05
  • 根据大家的意见,我做了以下实验,还是存在问题:

    1、操作系统:win2008 R2

    2、开发环境:vs2010(使用3.5框架)

    3、代码:

    前端:

    <%@ Page Language="vb" Debug="true" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="CMFly.Web.Report._Default" %>

    <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <rsweb:ReportViewer ID="ReportViewer1" runat="server"
                Width="809px">
                <ServerReport ReportPath="AudioVideo/Using"
                    ReportServerUrl="http://192.168.10.8/Reports" />
                <LocalReport ReportPath="Report/YearUsing.rdl">
                </LocalReport>
            </rsweb:ReportViewer>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
       </div>
        </form>
    </body>
    </html>

    后端:

    Public Class _Default
        Inherits System.Web.UI.Page

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Try
                Dim lo_Credentials As New ReportServerCredentials(True)
                With Me.ReportViewer1
                    .ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
                    .ShowToolBar = True
                    .ShowParameterPrompts = False
                    .ShowRefreshButton = False
                    .ServerReport.ReportServerUrl = New Uri(lo_Credentials.ReportServerUrl)
                    .ServerReport.ReportPath = "AudioVideo/Using"
                    .ServerReport.ReportServerCredentials = lo_Credentials
                    .ServerReport.Refresh()
                End With
            Catch ex As Exception
                Response.Write(ex.ToString)
            End Try
        End Sub

        Private Class ReportServerCredentials
            Implements Microsoft.Reporting.WebForms.IReportServerCredentials

            ''' <summary>
            ''' 使用ReportServer的NT域
            ''' </summary>
            ''' <remarks></remarks>
            Private ms_Domain As String = "VJackieSQL2008"

            ''' <summary>
            ''' 使用ReportServer的NT账号
            ''' </summary>
            ''' <remarks></remarks>
            Private ms_UserCode As String = "administrator"

            ''' <summary>
            ''' 使用ReportServer的NT账号密码
            ''' </summary>
            ''' <remarks></remarks>
            Private ms_Password As String = "......"

            ''' <summary>
            ''' 报表服务器Url
            ''' </summary>
            ''' <remarks></remarks>
            Public ReportServerUrl As String = "http://192.168.10.8/Reports"

            ''' <summary>
            '''
            ''' </summary>
            ''' <param name="authCookie"></param>
            ''' <param name="userName"></param>
            ''' <param name="password"></param>
            ''' <param name="authority"></param>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Public Function GetFormsCredentials(ByRef authCookie As System.Net.Cookie, ByRef userName As String, ByRef password As String, ByRef authority As String) As Boolean Implements Microsoft.Reporting.WebForms.IReportServerCredentials.GetFormsCredentials
                authCookie = Nothing
                userName = Nothing
                password = Nothing
                authority = Nothing
                Return False
            End Function

            ''' <summary>
            '''
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Public ReadOnly Property ImpersonationUser() As System.Security.Principal.WindowsIdentity Implements Microsoft.Reporting.WebForms.IReportServerCredentials.ImpersonationUser
                Get
                    Return Nothing
                End Get
            End Property

            ''' <summary>
            ''' 获取网络登录账号
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Public ReadOnly Property NetworkCredentials() As System.Net.ICredentials Implements Microsoft.Reporting.WebForms.IReportServerCredentials.NetworkCredentials
                Get
                    Return New System.Net.NetworkCredential(ms_UserCode, ms_Password, ms_Domain)
                End Get
            End Property

            ''' <summary>
            ''' 初始化
            ''' </summary>
            ''' <param name="ab_Test">是否测试</param>
            ''' <remarks></remarks>
            Public Sub New(ByVal ab_Test As Boolean)
                If ab_Test = False Then
                    ms_UserCode = System.Configuration.ConfigurationManager.AppSettings("DefaultReportViewerUser")
                    ms_Password = System.Configuration.ConfigurationManager.AppSettings("DefaultReportViewerPassword")
                    ms_Domain = System.Configuration.ConfigurationManager.AppSettings("DefaultReportViewerDomain")
                    ReportServerUrl = System.Configuration.ConfigurationManager.AppSettings("DefaultReportServerUrl")
                End If

                If String.IsNullOrEmpty(ReportServerUrl) Then ReportServerUrl = String.Format("http://{0}/ReportServer", System.Net.Dns.GetHostName())
                If Right(ReportServerUrl, 1) = "/" Then ReportServerUrl = ReportServerUrl.Substring(0, ReportServerUrl.Length - 1)
            End Sub

        End Class

    End Class

    4、运行结果(直接运行报表的结果见附件):

    • 尝试连接到报表服务器失败。请检查您的连接信息,确保报表服务器采用的是兼容版本。
      • 请求因 HTTP 状态 404 失败: Not Found。
    2012年6月27日 上午 08:51