我有这样的环境设置:
1)服务器A上的SQL Server 2)服务器B上的IIS。
SSRS报告,它在报告服务器A上工作正常。当我从本地开发机器运行代码时,它工作正常。 asp.net页面显示该报告没有任何问题。
但是,一旦我将asp.net上传到iis,它会显示以下错误。任何人都知道这可能是什么?这绝对是许可问题。但是,在代码中,我已经通过了凭证。我在下面列出了代码。
Server Error in '/' Application.
The request failed with HTTP status 401: Unauthorized.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[WebException: The request failed with HTTP status 401: Unauthorized.]
Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.GetSecureMethods() +232
Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.IsSecureMethod(String methodname) +60
Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.SetConnectionSSLForMethod(String methodname) +16
Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.ProxyMethodInvocation.Execute(RSExecutionConnection connection, ProxyMethod`1 initialMethod, ProxyMethod`1 retryMethod) +831
Microsoft.Reporting.WebForms.SoapReportExecutionService.LoadReport(String report, String historyId) +34
Microsoft.Reporting.WebForms.ServerReport.EnsureExecutionSession() +175
Microsoft.Reporting.WebForms.ServerReport.SetParameters(IEnumerable`1 parameters) +162
MvcReportViewer.ReportViewerExtensions.Initialize(ReportViewer reportViewer, ReportViewerParameters parameters) +741
MvcReportViewer.MvcReportViewer.ShopReport() +469
MvcReportViewer.MvcReportViewer.Page_Load(Object sender, EventArgs e) +51
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178
以下是代码:
protected void Page_Init(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials("myId", "myPassword", "myDomain");
// Set the processing mode for the ReportViewer to Remote
ReportViewer1.ProcessingMode = ProcessingMode.Remote;
ReportViewer1.ShowParameterPrompts = true;
ReportViewer1.PromptAreaCollapsed = true;
// Set the report server URL and report path
ReportViewer1.ServerReport.ReportServerUrl =
new Uri("http://report.mysite.com/ReportServer");
ReportViewer1.ServerReport.ReportPath =
"/Reports/myReport";
// Create the sales order number report parameter
ReportParameter MemberId = new ReportParameter();
MemberId.Name = "MemberId";
MemberId.Values.Add("1234567");
ReportParameter DbSever = new ReportParameter();
DbSever.Name = "DatabaseServer";
DbSever.Values.Add("report.mysite.com");
ReportParameter Dbname = new ReportParameter();
Dbname.Name = "Database";
Dbname.Values.Add("myDB");
// Set the report parameters for the report
ReportViewer1.ServerReport.SetParameters(
new ReportParameter[] { DbSever, Dbname, Uid, MemberId });
ReportViewer1.ServerReport.Refresh();
}
}