Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SSRS&;ASP.net ReportViewer rsAccessDenied_Asp.net_Reporting Services_Ssrs 2008 R2 - Fatal编程技术网

SSRS&;ASP.net ReportViewer rsAccessDenied

SSRS&;ASP.net ReportViewer rsAccessDenied,asp.net,reporting-services,ssrs-2008-r2,Asp.net,Reporting Services,Ssrs 2008 R2,我在报告服务器上运行了一个SSRS 2008 R2报告。当我使用报表管理器或Web服务URL访问报表时,它工作正常 http://mycomputer/ReportServer 及 当我将ReportViewer添加到WebForms网站并将其指向 http://mycomputer/reportserver 在使用VS.net的web服务器运行网站时,如果报告路径指向我的报告,则会出现拒绝访问错误 授予用户“mycomputer\myusername”的权限不足以执行此操作。(RSACC

我在报告服务器上运行了一个SSRS 2008 R2报告。当我使用报表管理器或Web服务URL访问报表时,它工作正常

http://mycomputer/ReportServer

当我将ReportViewer添加到WebForms网站并将其指向

http://mycomputer/reportserver 
在使用VS.net的web服务器运行网站时,如果报告路径指向我的报告,则会出现拒绝访问错误

授予用户“mycomputer\myusername”的权限不足以执行此操作。(RSACCESS拒绝)

下面是我在aspx页面中使用的确切代码

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Remote" Font-Names="Verdana"
    Font-Size="8pt" InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana"
    WaitMessageFont-Size="14pt" Width="712px">
    <ServerReport ReportPath="/MyReports" ReportServerUrl="http://mycomputer/reportserver" />
</rsweb:ReportViewer>

mycomputer\myusername是计算机上的管理员。我还将其作为管理员添加到ReportManager中

我使用IE在管理员模式下运行它

还有什么可能导致访问被拒绝的问题

我读过其他人有问题,但大多数人都不是2008R2的,所以我还没有弄清楚如何尝试他们所做的事情。没有可配置的IIS,也没有可访问报告的IUSR


SSRS日志只显示相同的错误消息,没有任何其他信息。

创建一个实现IReportServerCredentials的实例类应该可以解决这个问题。添加以下类并按如下方式调用它:

ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials("username", "pwd", "domain");

/// <summary>
/// Local implementation of IReportServerCredentials
/// </summary>
public class ReportServerCredentials : IReportServerCredentials
{
    private string _userName;
    private string _password;
    private string _domain;

    public ReportServerCredentials(string userName, string password, string domain)
    {
        _userName = userName;
        _password = password;
        _domain = domain;
    }

    public WindowsIdentity ImpersonationUser
    {
        get
        {
            // Use default identity.
            return null;
        }
    }

    public ICredentials NetworkCredentials
    {
        get
        {
            // Use default identity.
            return new NetworkCredential(_userName, _password, _domain);
        }
    }

    public bool GetFormsCredentials(out Cookie authCookie, out string user, out string password, out string authority)
    {
        // Do not use forms credentials to authenticate.
        authCookie = null;
        user = password = authority = null;
        return false;
    }
}
ReportViewer1.ServerReport.ReportServerCredentials=新的ReportServerCredentials(“用户名”、“pwd”、“域”);
/// 
///IReportServerCredentials的本地实现
/// 
公共类ReportServerCredentials:IReportServerCredentials
{
私有字符串\u用户名;
私有字符串\u密码;
私有字符串_域;
公共ReportServerCredentials(字符串用户名、字符串密码、字符串域)
{
_用户名=用户名;
_密码=密码;
_域=域;
}
公共WindowsIdentity模拟用户
{
得到
{
//使用默认标识。
返回null;
}
}
公共ICredentials网络凭据
{
得到
{
//使用默认标识。
返回新的网络凭据(\u用户名、\u密码、\u域);
}
}
public bool GetFormsCredentials(out Cookie authCookie、out string user、out string password、out string authority)
{
//不要使用表单凭据进行身份验证。
authCookie=null;
user=password=authority=null;
返回false;
}
}

感谢Phil Clewes:

我的错误,如果您使用ReportExecutionService,您只需使用NetworkCredential即可更新答案
ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials("username", "pwd", "domain");

/// <summary>
/// Local implementation of IReportServerCredentials
/// </summary>
public class ReportServerCredentials : IReportServerCredentials
{
    private string _userName;
    private string _password;
    private string _domain;

    public ReportServerCredentials(string userName, string password, string domain)
    {
        _userName = userName;
        _password = password;
        _domain = domain;
    }

    public WindowsIdentity ImpersonationUser
    {
        get
        {
            // Use default identity.
            return null;
        }
    }

    public ICredentials NetworkCredentials
    {
        get
        {
            // Use default identity.
            return new NetworkCredential(_userName, _password, _domain);
        }
    }

    public bool GetFormsCredentials(out Cookie authCookie, out string user, out string password, out string authority)
    {
        // Do not use forms credentials to authenticate.
        authCookie = null;
        user = password = authority = null;
        return false;
    }
}