ASP.NET - I am Getting This problem in IIS7 please Help me.

Asked By Hemadri on 15-Feb-11 04:32 PM
 

Server Error in '/Reportviewer' 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:

Line 166:
Line 167:            //set the params based on the param list.
Line 168:            serverReport.SetParameters(myParams);
Line 169:
Line 170:            string encoding, extension, deviceInfo;

Source File: D:\Reports_2005\CsiReporting\Report.cs    Line: 168

Stack Trace:

[WebException: The request failed with HTTP status 401: Unauthorized.]
   Microsoft.SqlServer.ReportingServices2005.Execution.RSExecutionConnection.GetSecureMethods() +204
   Microsoft.SqlServer.ReportingServices2005.Execution.RSExecutionConnection.IsSecureMethod(String methodname) +47
   Microsoft.SqlServer.ReportingServices2005.Execution.RSExecutionConnection.LoadReport(String Report, String HistoryID) +112
   Microsoft.Reporting.WebForms.ServerReport.GetExecutionInfo() +121
   Microsoft.Reporting.WebForms.ServerReport.SetParameters(IEnumerable`1 parameters) +67
   Com.Capricorn.Reporting.Report.Render(String& mimeType, Byte[]& results) in D:\Reports_2005\CsiReporting\Report.cs:168
   ReportViewer.SuperLeadReport.RenderReport() in D:\Reports_2005\ReportViewer\SuperLeadReport.aspx.cs:79
   ReportViewer.SuperLeadReport.renderReport_Click(Object sender, EventArgs e) in D:\Reports_2005\ReportViewer\SuperLeadReport.aspx.cs:59
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4955
James Murray replied to Hemadri on 15-Feb-11 05:59 PM
Hello Hamadri,

In the code above that you should have something like ServerReport.ReportServerUrl = new System.Uri("http://localhost/reportserver");.

Your reportserverurl is basically kicking back that the application does not have sufficient privileges to access the ReportServerURL.

If you are using <impersonate> in your web.config, I'd recommend granting that user (the imersonated account) full access to the ReportServerURL directory.

A 401 error generally states that the user or application does not have sufficient privileges to access either the web service or machine resource.

I hope that helps,
James