Report Viewer Web Control Version 10 Gives Error Despite Set Up Correctly - reporting-services

Reports are deployed and working, verified in Report Manager.
My application is an MVC2 app with my report on its own aspx page. This page worked with version 8 of the report viewer control, but we moved to new servers, upgraded sql server, and are trying to update our website to match.
The servers are Windows Server 2008 with IIS 7.5.
I am testing in both chrome and IE 9.
Despite my best efforts, I still get this error:
Report Viewer Configuration Error
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.
But, I've already done this. in fact, I even read this from MSDN:
To use IIS 7.0 in Integrated mode, you must remove the HTTP handler in system.web/httpHandlers. Otherwise, IIS will not run the application, but will display an error message instead.
Just to be safe, I tried a combo of neither while adding the handler into IIS directly, just the web server http handler in my config, just the http handler in my config, and both.
Let's start with my web.config
<configuration
<system.web>
<httpRuntime maxQueryStringLength="4096" />
<compilation targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<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" />
</assemblies>
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
</compilation>
</system.web>
<system.webServer>
<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>
</configuration>
I have the assemblies, the build provider, and the handler. What else could be wrong?

I found a quick and dirty workaround - to your web config add this:
<location path="Reserved.ReportViewerWebControl.axd">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
I saw in fiddler that for some reason when page requested Reserved.ReportViewerWebControl.axd instead of getting HTTP 200 response server would send 302 - moved to login.aspx?returnurl="Reserved.ReportViewerWebControl.axd. So allowing all users to the handler path solves the problem.

I thought its ReportViewer Rendering Issue on IIS7
I have manually mapped my reportviewer handle to IIS7 like this:
•Open Internet Information Services (IIS) Manager and select your Web application.
•Under IIS area, double-click on Handler Mappings icon.
•At the Action pane on your right, click on Add Managed Handler.
•At the Add Managed Handler dialog, enter the following:
Request path: Reserved.ReportViewerWebControl.axd
Type: Microsoft.Reporting.WebForms.HttpHandler
Name: Reserved-ReportViewerWebControl-axd
•Click OK.
also changed by web config by adding
Still mine's not working. I thought the above solution would help others.

I have tries this by removing unwanted mvc assemblies from asp.net project. So the simple solution was to remove WebMatrix.*.dll from Bin folder in web project as that belongs to mvc framework.

Related

SSRS Web Application Error. Having version issues

Here is what I have and I'm sure it is versioning but I can't seem to figure it out.
Visual Studio 2019
Framework : 4.7.2
This was Framework 3.5 and I upgraded to version 4.7.2. It was working until I open a report to edit and then it wants to edit the Report (RDLC).
Error1: Severity Code Description Project File Line Suppression State
Error The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' D:\Development\Work\asedra\Website\Reports\RptViolation.aspx 44
Error 2 : ASP.NET session has expired
Web.config:
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
</buildProviders>
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="Microsoft.ReportViewer.DataVisualization, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.ReportViewer.ProcessingObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.SqlServer.Types, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
</assemblies>
rdlc
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
the web page (.aspx)
<%# Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>[![enter image description here][1]][1]
Error1: Register ReportViewer on .aspx like this
<%# Register assembly="Microsoft.ReportViewer.WebForms" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
Add to web.config this line
<system.webServer>
<handlers>
<add name="ReportHandler" 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>
Error2: Store session state on SQL server. Here's a guide: HOW TO: Configure SQL Server to Store ASP.NET Session State.
Basically, you need to create ASPState database, activate ASP.NET State Service and add this line to the web.config:
<sessionState
mode="SQLServer"
sqlConnectionString="data source=127.0.0.1;user id=<username>;password=<strongpassword>"
cookieless="false"
timeout="20"
/>

CRM 2011 UR 18 Issue - Cannot Render Report

Getting this error (in the Application EventLog) when trying to display a particular report:
Exception message: The base class includes the field 'reportViewer', but its type (Microsoft.Reporting.WebForms.ReportViewer) is not compatible with the type of control (Microsoft.Reporting.WebForms.ReportViewer).
We have this in web.config for CRM:
<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>
...
<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
We're seeing an error on some machines, but not others.
This CRM machine has the Microsoft Report Viewer 2010 Redistributable Package installed. As I noted in the title, we have CRM 2011, UR 18.
Is there a different version of Report View that we need to install here?
We were able to resolve this issue. We had to install the Microsoft Report Viewer 2012 Runtime onto the CRM web server, https://www.microsoft.com/en-us/download/details.aspx?id=35747.
Microsoft had modified the PublicKeyToken for v2012 (which is version 11.0.0.0), so the resulting web.config edit also was more than just a version change.
The resulting, correct, CRMWeb web.config (for CRM 2011) is:
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false" />
</httpHandlers>
<compilation defaultLanguage="C#" debug="false">
<assemblies>
<add assembly="Microsoft.Crm, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.Crm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.Crm.Platform.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
<add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>

ASP.NET Razor Site: "This type of page is not served"

I've created an empty ASP.NET website (i.e. razor web pages) but I'm unable to reach the index.cshtml page.
This is true whether I have 'index.cshtml' in the URL or not.
The error pages says:
Server Error in '/' Application.
This type of page is not served.
Description: The type of page you have requested is not served because
it has been explicitly forbidden. The extension '.cshtml' may be
incorrect. Please review the URL below and make sure that it is
spelled correctly.
Requested URL: /index.cshtml
Here is the entire contents of the web.config
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="webpages:Enabled" value="true"/>
<add key="webpages:Version" value="3.0.0.0"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5" enableVersionHeader="false" requestValidationMode="2.0"/>
<pages validateRequest="false"/>
</system.web>
<system.webServer>
<security>
<requestFiltering allowDoubleEscaping="true">
<fileExtensions>
<remove fileExtension=".cshtml"/>
<add fileExtension=".cshtml" allowed="true"/>
</fileExtensions>
</requestFiltering>
</security>
<defaultDocument>
<files>
<remove value="index.cshtml"/>
<add value="index.cshtml"/>
</files>
</defaultDocument>
</system.webServer>
</configuration>
Can anyone tell me what I'm missing (or what I've added and which shouldn't be there)?

System.Web.Optimization cannot be used in a razor view file in a Class Library project

I am working in a modularized asp.net mvc4 project. Some views are located in a Class Library project. I already set the web.config to enable the intelligence in razor views. The #model, #Html.* and others are all working well. But when I try to reference a js file in my view by using the #Scripts.Render(). It says cannot find "Scripts". I checked the web.config file. The System.Web.Optimization is in the // node. I also installed Microsoft.AspNet.Web.Optimization package by Nuget.
I tried to type the code in a .cs file to use the System.Web.Optimization members, it works. But I cannot do same thing in the .cshtml file. Even when I typing #using System.Web.Optimization, it prompt me the Optimization cannot be found.
I am not sure what else I can do to resolve this issue. Any clues are very appreciated.
If you have a Web.config at the root of the class library, confirm it contains the following: <add namespace="System.Web.Optimization"/>
If you do not, trick Visual Studio into thinking that it is a web project and enable Intellisense and resolve your issue by adding a web.config file to the root of your class library project (the one that contains the Razor views) with the following contents (taken from this blog post) :
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
</system.web.webPages.razor>
<system.web>
<compilation targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</assemblies>
</compilation>
</system.web>
</configuration>
The above is what worked for me when I faced this issue, but here are more links:
http://forums.asp.net/t/1812274.aspx/1
Getting System.Web.Optimization to work in a razor view within a class library

ASP.NET MVC 2 - Trying to configure role/user management via ASP.NET Configuration Tool

First, my development environment: Win7 laptop with Visual Studio Professional 2010. IIS is NOT installed.
I'm trying to turn on and set up some roles for user management via the ASP.NET Configuration Tool, as demonstrated in the MVCMusicStore tutorial. When I click on the 'Security' tab, I get the following error:
"There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.
The following message may help in diagnosing the problem: Could not load type 'HandiGamer.MvcApplication'."
When I click on the 'button below', it tells me I'm using AspNetSqlProvider as my provider. When I try to test it, it tells me:
"Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider."
Here's the thing:
The MVCMusicStore demo's role/user management works when I run it through the debugger. I can add myself as a customer, and add/remove items from my cart. Despite this, when I attempt to use the Configuration Tool with it, I get the same errors.
I actually have run aspnet_regsql on my copy of SQL Server 2008 Express. It created the necessary tables for user management. Still didn't fix my problem.
I'm just wondering if I'm missing something obvious, as the tutorial essentially said "Click two buttons and you're all set." It literally said nothing about setting up the db for this.
I'm just stumped at this point. Role/user management works (the MVCMusicStore proves that it does), but the configuration tool won't let me turn it on, set it up, or otherwise edit how it works. It's becoming very frustrating. Any help would be greatly appreciated.
EDIT: My web.config is as follows-
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<configuration>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
<add name="HandiGamer" connectionString="data source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|handigamer.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="HandiGamer" />
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="HandiGamer" />
</providers>
</profile>
<roleManager enabled="true">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="HandiGamer" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="HandiGamer" />
</providers>
</roleManager>
<pages>
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Found the solution. Had to compile/build my solution before the config tool would 'see' the db security stuff.