SQL-2008报表服务器错误"HTTP状态401:未经授权." [英] Sql-2008 Report server Error " HTTP status 401: Unauthorized.."

查看:88
本文介绍了SQL-2008报表服务器错误"HTTP状态401:未经授权."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请求失败,HTTP状态为401:未授权.
您好,我试图将我在sql2008中开发的报告托管到报告server.im中,并收到上述错误.
尽管这些在本地工作,但证书却出现问题.
我尝试了很多方法,但无法找到解决方案.
我试图将以下标记放在< system.web>

< identity impersonate ="true" userName ="SQL2008R2_" password ="***"/>

The request failed with HTTP status 401: Unauthorized.
hi im trying to host my reports developed in sql2008 to reporting server.im getting the above error.
though these working locally im getting problem with credentials.
i tried in many ways but im not able to find the solution.
i tried to put following tag inside <system.web>

<identity impersonate="true" userName="SQL2008R2_" password="***"/>

if (!IsPostBack)
        {
            rptViewWeeksales.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
            rptViewWeeksales.ServerReport.ReportServerUrl = new Uri("https://rs2k801.discountasp.net/ReportServer");//for local system:URL http://localhost:8080/Reportserver
            string strReport = @"/globalaviat/Reports/scm/rptweekSales";
            this.rptViewWeeksales.ServerReport.ReportPath = strReport;
            Microsoft.Reporting.WebForms.ReportParameter[] @territoryId = new Microsoft.Reporting.WebForms.ReportParameter[1];
            @territoryId[0] = new Microsoft.Reporting.WebForms.ReportParameter("territoryid", Session["territoryid"].ToString());
            rptViewWeeksales.ServerReport.SetParameters(@territoryId);
            rptViewWeeksales.ServerReport.Refresh();
        }




我在部署到服务器(如文件夹路径,服务器url,数据源等)时进行了正确配置.
请帮助我.




i configured properly while deploying to server like folder path,server url,datasource etc.
plz help me.

推荐答案

对不起,我不好-我忘了那是只读的

您必须设置 rptInventory.ServerReport.ReportServerCredentials

看一下此链接,其中完整说明了如何执行此操作(向下滚动至H.Laasri的答案)

http://int.social.msdn.microsoft. com/Forums/en/vsreportcontrols/thread/5aa7eee7-d4a7-427a-ab8d-7a3d4d4f0bf3 [
Sorry, my bad - I forgot that was Read Only

You''ve got to set rptInventory.ServerReport.ReportServerCredentials

Have a look at this link, which explains in full how to do this (scroll down to the answer by H.Laasri)

http://int.social.msdn.microsoft.com/Forums/en/vsreportcontrols/thread/5aa7eee7-d4a7-427a-ab8d-7a3d4d4f0bf3[^]

public partial class ReportViewerCredentials : IReportServerCredentials
    {
        private string _userName;
        private string _password;
        private string _domain;
        public ReportViewerCredentials(string userName, string password, string domain)
        {
            _userName = userName;
            _password = password;
            _domain = domain;
        }

        public WindowsIdentity ImpersonationUser
        {
            get
            {
                //return null;
                return WindowsIdentity.GetCurrent();
            }
        }
        public ICredentials NetworkCredentials
        {
            get
            {
                return new NetworkCredential(_userName, _password, _domain);
            }
        }
        public bool GetFormsCredentials(out Cookie authCookie,
                out string userName, out string password,
                out string authority)
        {
            authCookie = null;
            userName = _userName;
            password = _password;
            authority = _domain;
            // Not using form credentials
            return false;
        }
    }
protected void Page_Load(object sender, EventArgs e)
    {
        ShowReport();
    }
private void ShowReport()
    {
        try
        {
             ReportViewerCredentials rpCredentials = new ReportViewerCredentials(ConfigurationManager.AppSettings["ReportUser"], ConfigurationManager.AppSettings["ReportPassword"], ConfigurationManager.AppSettings["ReportDomain"]);
             ReportViewer1.ServerReport.ReportServerCredentials = rpCredentials;
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }


是,在提供凭据后可以在服务器端正常工作.
但是当我尝试使用asp.net aspx页面时,会抛出上述错误.

rptInventory.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;


ICredentials凭据=新的NetworkCredential("xyzuser","xyzpassword","globalaviatech.com");



rptInventory.ServerReport.ReportServerUrl =新的Uri("https://rs2k801.discountasp.net/ReportServer");
字符串strReport = @"/globalaviat/Reports/scm/SalesOfTerritory";
this.rptInventory.ServerReport.ReportPath = strReport;
Microsoft.Reporting.WebForms.ReportParameter [] @territoryid =新的Microsoft.Reporting.WebForms.ReportParameter [1];
@territoryid [0] =新的Microsoft.Reporting.WebForms.ReportParameter("territoryid",Session ["territoryid"].ToString());
rptInventory.ServerReport.SetParameters(@territoryid);
rptInventory.ServerReport.Refresh();
}
yes after giving credentials it is properly working on server side.
but when i try using my asp.net aspx page it is throwing the above error.

rptInventory.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;


ICredentials credentials = new NetworkCredential("xyzuser", "xyzpassword", "globalaviatech.com");



rptInventory.ServerReport.ReportServerUrl = new Uri("https://rs2k801.discountasp.net/ReportServer");
string strReport = @"/globalaviat/Reports/scm/SalesOfTerritory";
this.rptInventory.ServerReport.ReportPath = strReport;
Microsoft.Reporting.WebForms.ReportParameter[] @territoryid = new Microsoft.Reporting.WebForms.ReportParameter[1];
@territoryid[0] = new Microsoft.Reporting.WebForms.ReportParameter("territoryid", Session["territoryid"].ToString());
rptInventory.ServerReport.SetParameters(@territoryid);
rptInventory.ServerReport.Refresh();
}


您似乎尚未将凭据设置为ServerReport

例如

rptInventory.ServerReport.ReportServerCredentials =凭据;


http://www.devx.com/dotnet/Article/30424/1763/page/3 [^ ]
You don''t seem to have set the credentials to the ServerReport

e.g.

rptInventory.ServerReport.ReportServerCredentials = credentials;


http://www.devx.com/dotnet/Article/30424/1763/page/3[^]


这篇关于SQL-2008报表服务器错误"HTTP状态401:未经授权."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆