gpt4 book ai didi

c# - 由 SSRS 2012 中的 C# 代码创建的报告返回 Client found response content type of '' , but expected 'text/xml'

转载 作者:太空宇宙 更新时间:2023-11-03 11:16:24 27 4
gpt4 key购买 nike

我迁移了在 Windows Server 2003 Std 上运行的 Reporting Services 2005 安装。 32 位到运行 Windows Server 2008 Enterprise 32 位(非 2008 R2)以及 SQL Server 和 Reporting Services 2012 的新服务器。

一切正常,直到我们尝试从我们的应用程序运行报告,该应用程序具有运行报告的自定义类。它们在 2005 年运行良好,但在 2012 年将无法运行。

具体错误是:

Client found response content type of '', but expected 'text/xml'.

方法中抛出错误:

        [System.Web.Services.Protocols.SoapHeaderAttribute("SessionHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
[System.Web.Services.Protocols.SoapHeaderAttribute("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices/Render" +
"", RequestNamespace="http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices", ResponseNamespace="http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("Result", DataType="base64Binary")]
public System.Byte[] Render(string Report, string Format, string HistoryID, string DeviceInfo, ParameterValue[] Parameters, DataSourceCredentials[] Credentials, string ShowHideToggle, out string Encoding, out string MimeType, out ParameterValue[] ParametersUsed, out Warning[] Warnings, out string[] StreamIds) {
object[] results = this.Invoke("Render", new object[] {
Report,
Format,
HistoryID,
DeviceInfo,
Parameters,
Credentials,
ShowHideToggle});
Encoding = ((string)(results[1]));
MimeType = ((string)(results[2]));
ParametersUsed = ((ParameterValue[])(results[3]));
Warnings = ((Warning[])(results[4]));
StreamIds = ((string[])(results[5]));
return ((System.Byte[])(results[0]));
}

同样,这在 2005 SSRS 上运行良好,但在 2012 SSRS 上运行良好。

任何想法可能是什么问题?任何帮助将不胜感激。

谢谢。何塞

最佳答案

  1. 确保您的应用程序/网络服务器在新服务器的报表服务器角色中有一个条目。如果是这样,您可能希望将其删除并重新添加。例如,在我们的 SSRS 服务器的报表管理器中,在“Home”文件夹的安全性上(位于 https://your.reporting.services.server/Reports/Pages/Folder.aspx?ItemPath=%2f&SelectedTabId=PropertiesTab ),我们的 Web 服务器有一个条目:

    OURDOMAIN\WEBSERVERNAME$   Public
  2. 检查您如何从应用程序/网络服务器向 SSRS 服务器提供凭据。我们使用自定义类:

公共(public)类 ReportViewerServerConnection 实现 IReportServerConnection2

  Public ReadOnly Property ReportServerUrl() As System.Uri Implements Microsoft.Reporting.WebForms.IReportServerConnection.ReportServerUrl
Get
Return New Uri(System.Configuration.ConfigurationManager.AppSettings.Get("ReportServerUrl"))
End Get
End Property

Public ReadOnly Property Timeout() As Integer Implements Microsoft.Reporting.WebForms.IReportServerConnection.Timeout
Get
Return CInt(System.Configuration.ConfigurationManager.AppSettings.Get("ReportServerTimeout"))
End Get
End Property

Public ReadOnly Property Cookies() As System.Collections.Generic.IEnumerable(Of System.Net.Cookie) Implements Microsoft.Reporting.WebForms.IReportServerConnection2.Cookies
Get
Return Nothing
End Get
End Property

Public ReadOnly Property Headers() As System.Collections.Generic.IEnumerable(Of String) Implements Microsoft.Reporting.WebForms.IReportServerConnection2.Headers
Get
Return Nothing
End Get
End Property

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
'Not using form credentials
authCookie = Nothing
userName = Nothing
password = Nothing
authority = Nothing

Return False
End Function

Public ReadOnly Property ImpersonationUser() As System.Security.Principal.WindowsIdentity Implements Microsoft.Reporting.WebForms.IReportServerCredentials.ImpersonationUser
Get
'Use the default windows user. Credentials will be
'provided by the NetworkCredentials property.
Return Nothing
End Get
End Property

Public ReadOnly Property NetworkCredentials() As System.Net.ICredentials Implements Microsoft.Reporting.WebForms.IReportServerCredentials.NetworkCredentials
Get
Return Net.CredentialCache.DefaultCredentials
End Get
End Property
End Class

...和 ​​web.config 中的条目:

<configuration>
<appSettings>

<!-- magic value: http://msdn.microsoft.com/en-us/library/ms251661%28VS.90%29.aspx -->
<add key="ReportViewerServerConnection" value="Our.WebApplication.ReportViewerServerConnection, Our.WebApplication.Assembly" />
</appSettings>
</configuration>
  1. 在 SSRS 服务器上尝试 SQL Server Profiler,看看 ReportServer 数据库和数据源数据库中发生了什么(如果有的话)。如果数据库中没有发生任何事情,则一定存在网络、权限或 SSL 问题。

  2. 检查 SSL 问题。 ( fiddler ?)

  3. 在您的应用程序中,删除对 SSRS 网络服务的引用,然后将其再次添加到新服务器。

  4. 检查 Reporting Services 日志文件;例如“C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\LogFiles”。

关于c# - 由 SSRS 2012 中的 C# 代码创建的报告返回 Client found response content type of '' , but expected 'text/xml',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12537810/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com