简体   繁体   中英

I Have a windows form application running on LAN having SRSS Report prompting error The HTTP request failed 401 unauthorized but running fine on my pc

I Have a windows form application running on LAN having SRSS Report prompting error The HTTP request failed 401 unauthorized but running fine on my pc

reportViewer2.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
reportViewer2.ServerReport.ReportServerUrl = new Uri("http://mysystemname/ReportServer");
reportViewer2.ServerReport.ReportPath ="/InventoryReports2019/StockRegister";
reportViewer2.ShowParameterPrompts = false;
this.reportViewer2.RefreshReport();

try this may be it will help you and try to give full path of your report i think you are missing credentials option

    reportViewer1.ProcessingMode = ProcessingMode.Remote;  

    ServerReport serverReport = reportViewer1.ServerReport;  

    // Get a reference to the default credentials  
    System.Net.ICredentials credentials =  
        System.Net.CredentialCache.DefaultCredentials;  

    // Get a reference to the report server credentials  
    ReportServerCredentials rsCredentials =  
        serverReport.ReportServerCredentials;  

    // Set the credentials for the server report  
    rsCredentials.NetworkCredentials = credentials;  

    // Set the report server URL and report path  
    serverReport.ReportServerUrl =   
        new Uri("https:// <Server Name>/reportserver");  
    serverReport.ReportPath =   
        "/AdventureWorks Sample Reports/Sales Order Detail";  

    // Create the sales order number report parameter  
    ReportParameter salesOrderNumber = new ReportParameter();  
    salesOrderNumber.Name = "SalesOrderNumber";  
    salesOrderNumber.Values.Add("SO43661");  

    // Set the report parameters for the report  
    reportViewer1.ServerReport.SetParameters(  
        new ReportParameter[] { salesOrderNumber });  

    // Refresh the report  
    reportViewer1.RefreshReport();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM