With VS2010 I have started a fresh Azure project with one MVC2 webrole that has only one Asp.Net webform.
Problem
I'm running into a problem that my ReportViewer keeps loading and I can't get it working properly with version 10.0
? Version 9.0
is working like a charm, but I can't find the differences between these two.
Internet Explorer keeps blinking, but with Chrome's 'inspector' I can see that the following error occurs:
<h2>
Report Viewer Configuration Error
</h2><p>The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file. Add <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> to the system.web/httpHandlers section of the web.config file, or add <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> to the system.webServer/handlers section for Internet Information Services 7 or later.</p>
What I did so far
I drag and drop (as adviced on multiple sites) just one ScriptManager
and ReportViewer
.
The project references are created automatically and the web.config's assemblies looks OK.
<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
The next step I do is add the handler to the web.config:
<system.web>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*"
type="Microsoft.Reporting.WebForms.HttpHandler,
Microsoft.ReportViewer.WebForms, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"
/>
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<!-- added handler for reporting -->
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
</system.webServer>
After that I set the reporting properties within <script runat="server"></script>
so that I can debug easily.
My webform
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Report.aspx.cs" Inherits="MvcWebRole1.Reports.Report" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
ReportViewer1.ProcessingMode = ProcessingMode.Remote;
ReportViewer1.ServerReport.ReportServerUrl = new Uri("https://XXXX.reporting.windows.net/ReportServer");
ReportViewer1.ServerReport.ReportPath = "/MyReport.rdl";
ReportViewer1.ServerReport.ReportServerCredentials = new Credentials();
}
public class Credentials : IReportServerConnection
{
public IEnumerable<System.Net.Cookie> Cookies { get { return null; } }
public Uri ReportServerUrl { get { return new Uri("https://XXXX.reporting.windows.net/ReportServer"); } }
public int Timeout { get { return 60000; } }
public bool GetFormsCredentials(out System.Net.Cookie authCookie, out string userName, out string password, out string authority)
{
authCookie = null;
userName = "MyUserName";
password = "MyPassword";
authority = "XXXX.reporting.windows.net";
return true;
}
public System.Security.Principal.WindowsIdentity ImpersonationUser { get { return null; } }
public System.Net.ICredentials NetworkCredentials { get { return null; } }
}
</script>
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server">
</rsweb:ReportViewer>
</div>
</form>
</body>
</html>
What's next?
Does anyone has any idea how I can resolve this issue!?
So, so far:
- Reporting Version 10.0
- Web.config looks OK for assemblies and handlers as well
- I tried visual studio debugger
- I tried IIS Express
- I tried an Windows Azure project (with emulator)