C# – Reports created by C# code in SSRS 2012 return Client found response content type of ”, but expected ‘text/xml’

creporting-servicesreporting-services-2012ssrs-2012upgrade

I migrated an installation of Reporting Services 2005 running on Windows Server 2003 Std. 32Bit to a new server running Windows Server 2008 Enterprise 32Bit (not 2008 R2) with SQL Server and Reporting Services 2012.

Everything worked fine until we tried to run the reports from our application which has a custom class that run the reports. They work fine in 2005 but won't work in 2012.

The specific error is:

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

The error is thrown in the method:

        [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]));
        }

Again, this is working fine against the 2005 SSRS but not the 2012 SSRS.

Any ideas what might be the issue? Any help would be appreciated.

Thanks.
Jose

Best Answer

  1. Make sure your application/web server has an entry in the Report Server roles of new server. If so, you may want to delete it and add it again. For example, in Report Manager of our SSRS server, on the security for the "Home" folder (at https://your.reporting.services.server/Reports/Pages/Folder.aspx?ItemPath=%2f&SelectedTabId=PropertiesTab), we have an entry for our web server:

    OURDOMAIN\WEBSERVERNAME$   Public
    
  2. Review how you are providing the credentials from application/web server to SSRS server. We use a custom class:

Public Class ReportViewerServerConnection Implements 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

... and an entry in 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. Try SQL Server Profiler on the SSRS server to see what, if anything, is happening in the ReportServer database and data source databases. If nothing is happening in the database, then there must be a network, permission, or SSL issue.

  2. Check for SSL issues. (Fiddler?)

  3. In your application, drop the reference to the SSRS web service, and add it again to the new server.

  4. Check the Reporting Services log file; for example "C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\LogFiles".

Related Topic