Click here to Skip to main content
15,892,199 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
SQL 2008R2 SSRS report server working on internet explore but when it calling reportviewer using Visual Studio 2010 ASP.net C# following error occurred.

C#
{"The attempt to connect to the report server failed.  Check your connection information and that the report server is a compatible version."}
    [Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.MissingEndpointException]: {"The attempt to connect to the report server failed.  Check your connection information and that the report server is a compatible version."}
    Data: {System.Collections.ListDictionaryInternal}
    HelpLink: null
    HResult: -2146233088
    InnerException: {"The request failed with HTTP status 404: Not Found."}
    Message: "The attempt to connect to the report server failed.  Check your connection information and that the report server is a compatible version."
    Source: "Microsoft.ReportViewer.WebForms"
    StackTrace: "   at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.MissingEndpointException.ThrowIfEndpointMissing(WebException e)\r\n   at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.ProxyMethodInvocation.Execute[TReturn](RSExecutionConnection connection, ProxyMethod`1 initialMethod, ProxyMethod`1 retryMethod)\r\n   at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.LoadReport(String Report, String HistoryID)\r\n   at Microsoft.Reporting.WebForms.ServerReport.EnsureExecutionSession()\r\n   at Microsoft.Reporting.WebForms.ServerReport.SetParameters(IEnumerable`1 parameters)\r\n   at WEB.EmployeeCount.ShowReport() in Apppath/unt.aspx.cs:line 162"
    TargetSite: {Void ThrowIfEndpointMissing(System.Net.WebException)}


What I have tried:

C#
<pre lang="ASP.NET">&lt;pre lang=&quot;ASP.NET&quot;&gt;&amp;lt;%@ Page Title=&amp;quot;&amp;quot; Language=&amp;quot;C#&amp;quot; MasterPageFile=&amp;quot;~/Site.Master&amp;quot; AutoEventWireup=&amp;quot;true&amp;quot; CodeBehind=&amp;quot;EmployeeCount.aspx.cs&amp;quot; Inherits=&amp;quot;WEB.EmployeeCount&amp;quot; %&amp;gt;

&amp;lt;%@ Register Assembly=&amp;quot;Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&amp;quot;
    Namespace=&amp;quot;Microsoft.Reporting.WebForms&amp;quot; TagPrefix=&amp;quot;rsweb&amp;quot; %&amp;gt;


&amp;lt;asp:Content ID=&amp;quot;Content2&amp;quot; ContentPlaceHolderID=&amp;quot;MainContent&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;rsweb:ReportViewer ID=&amp;quot;ReportViewer1&amp;quot; runat=&amp;quot;server&amp;quot; ProcessingMode=&amp;quot;Remote&amp;quot;&amp;gt;
    &amp;lt;/rsweb:ReportViewer&amp;gt;
    &amp;lt;asp:ScriptManager ID=&amp;quot;ScriptManager1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;/asp:ScriptManager&amp;gt;
&amp;lt;/asp:Content&amp;gt;&lt;/pre&gt;


&lt;pre lang=&quot;C#&quot;&gt;private void ShowReport()
        {
            try
            {


                ReportViewer1.ProcessingMode = ProcessingMode.Remote;

                ServerReport serverReport = ReportViewer1.ServerReport;
                serverReport.ReportServerUrl =
                    new Uri(&amp;quot;https://LKCSCAPP03.com:443&amp;quot;);

                


                // Set the report server URL and report path  
                serverReport.ReportPath =  &amp;quot;/Pages/Report.aspx?ItemPath=%2fPayrollReport%2fCompanyList&amp;quot;;

                IReportServerCredentials irsc = new CustomReportCredentials(&amp;quot;UserID&amp;quot;, &amp;quot;Password&amp;quot;, &amp;quot;Domain&amp;quot;);
                serverReport.ReportServerCredentials = irsc;


                
                ReportParameter reportParameterValue = new ReportParameter();
                serverReport.SetParameters(new ReportParameter[] { reportParameterValue });

                serverReport.Refresh();

                
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }&lt;/pre&gt;</pre>


<pre lang="C#">public class CustomReportCredentials : IReportServerCredentials
        {
            private string _UserName;
            private string _PassWord;
            private string _DomainName;

            public CustomReportCredentials(string UserName, string PassWord, string DomainName)
            {
                _UserName = UserName;
                _PassWord = PassWord;
                _DomainName = DomainName;
            }

            [System.Runtime.InteropServices.DllImport(&quot;advapi32.dll&quot;, SetLastError = true)]
            public static extern bool LogonUser(
                    string lpszUsername,
                    string lpszDomain,
                    string lpszPassword,
                    int dwLogonType,
                    int dwLogonProvider,
                    out IntPtr phToken);

            public System.Security.Principal.WindowsIdentity ImpersonationUser
            {
                get
                {
                    // Use credentials from config file

                    IntPtr userToken = IntPtr.Zero;

                    bool success = LogonUser(
                      _UserName,
                      _DomainName,
                      _PassWord,
                      9,//LOGON_TYPE_NEW_CREDENTIALS
                      3,//LOGON32_PROVIDER_WINNT50
                      out userToken);

                    if (!success)
                    {
                        throw new Exception(&quot;Logon user failed&quot;);
                    }

                    return new WindowsIdentity(userToken);
                }
            }




            public ICredentials NetworkCredentials
            {
                get { return new NetworkCredential(_UserName, _PassWord, _DomainName); }
            }

            public bool GetFormsCredentials(out Cookie authCookie, out string user,
             out string password, out string authority)
            {
                authCookie = null;
                user = password = authority = null;
                return false;
            }
        }</pre>
Posted
Updated 28-Nov-16 1:35am
v2
Comments
Duminda Dissanayake 28-Nov-16 6:58am    
Please Help me how to Call SSRS report server in ASP.net using Visual studio 2010. ReportViewer controller not working.
#realJSOP 28-Nov-16 7:33am    
I think you meant to say that "I'm not doing it right".

1 solution

Make sure your connectionstring is correct.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900