same ScriptResource,axd loaded twice - asp.net

Good Morning,
We have an existing application that is stable and error free on a Windows Server 2008R2 with IIS 7.5 / .NET 4.5.
We are planning a move to Windows Server 2012R2 with IIS 8.5 / .NET 4.5 and are now encountered the problem that the application (identical binaries / configuration) are indeed injected two ScriptResource.axd files, but both contain the same content (different URLs).
Because of this, the MicrosoftAjaxWebforms.js, which provides "Sys.WebForms" is missing and i'm getting the Error
Unable to get property 'PageRequestManager' of undefined or null reference
The problem is browser Independent on two independent virtual machines.
The application runs in classic mode, the web.config does not contain the < xhtmlConformance > tag.
There are all the latest server updates.
All other functionalities of the application are working properly.
I hope some of you encountered the same Problem and know the solution.
Greetings, Verni
EDITH:
Snippet of web.config (system.web section)
<system.web>
<httpRuntime requestValidationMode="2.0" requestPathInvalidCharacters="" targetFramework="4.5" enableVersionHeader="false" />
<sessionState timeout="30" mode="StateServer" stateConnectionString="tcpip=...:42424" />
<httpModules>
<add name="LinkPartnerModule" type="....LinkPartnerModule, ..." />
<add name="RedirectModule" type="....RedirectModule, ..." />
<add name="ScriptCompressorModule" type="ScriptCompressorModule, ..." />
</httpModules>
<httpHandlers>
<remove verb="*" path="scriptresource.axd"/> // added from StackOverflow
<add verb="*" path="*js.axd" type="ScriptCompressorHandler" />
</httpHandlers>
<compilation debug="false" defaultLanguage="c#" targetFramework="4.5">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.Services.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<globalization culture="de-DE" enableClientBasedCulture="true" fileEncoding="utf-8" uiCulture="de" />
<pages compilationMode="Auto" styleSheetTheme="*" validateRequest="false" enableEventValidation="false" controlRenderingCompatibilityVersion="3.5" enableViewState="true" clientIDMode="AutoID">
</system.web>
<system.web.extensions>
<scripting>
<scriptResourceHandler enableCompression="true" enableCaching="true" />
</scripting>
</system.web.extensions>

We had this issue as well for an application running in classic mode. The issue that time turned out to be multiple httphandlers registered for the .axd extension.
If you in your web.config make sure to remove any .axd handler before adding them it might resolve your issue.
Something like:
<remove verb="*" path="scriptresource.axd"/>
Edit:
When looking at your web.config I'm pretty sure the problem is related to the scriptcompressorhandler and module. As you stated this only happens using HTTPS and I suspect that what happens is that the module still runs over HTTPS but the handler does not. This means that the module sends the compressed version over to the regular scriptresource handler and a new copy of the script is outputted.
The solution would be to either activate scriptcompressorhandler over HTTPS as well or make sure the module is not run over HTTPS.

I fixed the Problem.
The reason was an misconfigured ARR (Application Request Router),
where SSL-Offloading was active.
The main reason of misconfiguration was the "function" that activates SSL-Offloading if no URL-Rewrite Rule is there with name like 'ARR_farmName_loadbalance_SSL'.
If this Rule will be deleted, the manager activates SSL-Offloading automatically.
Thanks to Robban, who brought me to HTTPS / SSL.

Related

ReportViewer not working on web server

Over the last month, I developed a WebForm app in C# with VS2013. It is working perfectly when I debug it and almost perfectly too once published on my iis 7.5 server on a App Pool using .NET Framework v4.030319. The problem is that the report viewer control doesn't work, exactly like this blog:
http://blogs.msdn.com/b/webtopics/archive/2009/02/10/report-viewer-toolbar-does-not-render-properly-on-iis-7-0.aspx
or the 49 other blogs I have read in the last 4 days... I tried every solution suggested and none of them worked. I am 100% sure it's not due to my report because just for testing, I created a basic report (just a textbox, no parameters, no datasource) and a new project with one page that load this report and I got the same problem.
Here is the concerned code in the web.config file:
<system.web>
<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>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
<add assembly="Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
<add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
</assemblies>
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</buildProviders>
</compilation>
<httpRuntime targetFramework="4.5" />
[...]
</system.web>
<system.webServer>
<modules>
<remove name="FormsAuthentication" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="ReportViewerWebControl" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</handlers>
</system.webServer>
And yes, I the mapping is also created on the server. Can someone help me fix this problem. I'm a little distraught.
I finally resolved it by installing the followings on the server:
dotNetFx45
ReportViewer 2010 Redistributable
Microsoft Microsoft System CLR Types for SQL Server 2012
ReportViewer 2012 Runtime
and restart it after even if it's not asked. After that, the reports were displaying properly. The fact that I didn't get any error messages wasn't helping very much. Also, the server is on prod so I couldn't restart it every time I want. Anyway, it's working now and that's the only thing that matters. Thanks.
For me these 2 mentioned below and no server restart worked
ReportViewer 2010 Redistributable
ReportViewer 2012 Runtime
Thanks

Images folder in separate applications

I have a web application with an admin panel. The admin panel is a webform project and I also have an MVC project to list products inserted in admin panel. But when I upload images to ProductImgs folder in webform project, how can I get them from MVC project? Or can I save them to the MVC project folder?
Ok so sounds like you are trying to share images between two web applications? EDIT Also you are trying to do this using Cassini (the inbuilt dev web server).
The easiest way to do this is to move your development environment to using IIS and then create a virtual directory within your mvc project in IIS that points to the images folder in your other site (on your file system). NB Moving to IIS will also have the added benefits of making your solution be more in line with how it will be deployed which IMHO is a great benefit.
Say you call this virtual directory 'images' and it has two images (image1.jpg and image2.jpg).
You can then reference these images from your mvc site by using
<img src="/images/image1.jpg" />
Here is a link on how to create Virtual Directories.
http://support.microsoft.com/kb/172138
Now i found the solution: here is the root web.config to solve this issue
<location inheritInChildApplications="false">
<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.Helpers, Version=1.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=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages"/>
<add namespace="EkosWeb.Helpers"/>
</namespaces>
</pages>
</system.web>
</location>
I need to add inheritInChildApplications="false" to location.

ASP.NET Charting Control not working on production server

I have an application that relies heavily on charting and currently the charts will work in the ASP.Net Development Server, but when I try to publish out to my server (Win 2008 Server R2, IIS 7), the charts do not show up.
Using Firebug, I can see that the call to ChartImg.axd returns a 404, and all I get is a blank image holder in IE, or nothing in Firefox. I've searched for about 3 or 4 hours so far, and have tried just about everything recommended, but nothing seems to be working.
I would like to use memory/HttpImageHandler, instead of the ImageLocation configuration.
My Web.Config
<appSettings>
<!--<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />-->
<add key="ChartImageHandler" value="storage=memory;timeout=20;deleteAfterServicing=false" />
</appSettings>
<system.webServer>
<handlers>
<remove name="ChartImageHandler" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST"
path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
<system.web>
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false" />
</httpHandlers>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
<customErrors mode="Off"/>
</system.web>
Does anyone have any ideas where I'm going wrong to keep this from working on my server?
I found the answer to my problem, but I believe that my problem stemmed specifically from how my code runs.
Once I set privateImages=false under appSettings for my ChartImageHandler, my images came up with no problem, using ImageLocation with file storage or HttpHandler with memory storage.
I looked at the listing here and realized that my code has NONE of the following:
Authentication
SessionID
AnonymousID
so the implicit default setting of privateImages=true was keeping me from downloading my images. When I set privateImages=false I had no problems and the charts worked correctly. I set my application to use Windows Authentication, and set privateImages=true and my charts are now being generated with either the Image Location setting or the HttpHandler setting.
Hopefully this is helpful. I know I spent a long time digging around and got nowhere.
This configuration work for me. You need to use memory as storage.
< add key="ChartImageHandler" value="storage=memory;deleteAfterServicing=true;timeout=20;"/>
It seems like security/permission issue. Are you saving charts to local folder, then assign write permission for IIS user and/or network services users for that folder.
Install the Microsoft Chart Controls on your webserver or try this:
ASP.Net Chart Control On Shared Hosting Environment
Also check that the HttpHandler is registered in system.webServer in your web.config when running under IIS 7.
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
try this: change Version=4.0.0.0 to Version=3.5.0.0
try this it was resolved in case of web.config runtime error
<pre>
<add key="ChartImageHandler" value="storage=memory;timeout=20;deleteAfterServicing=true;Url=~\temp\"
/>

http error 500.19 - Internal server error

I am trying to get an application (that I didn't develop) running on a windows 2008 r2 64-bit server running IIS 7.5.
I am getting the above stated error - here are more details -
The requested page cannot be accessed because the related configuration data for the page is invalid
Error Code 0x8007007e
I know that the server can access the web.config, because if I make changes to it, the error code changes.
I also know that it is a correct web.config, because it is running successfully on a different server with the same file.
Does anyone have any idea what might be causing this. The error message I am getting really doesn't tell me anything.
I have tried using FailedRequestTracing, but either I don't know how to read those logs or there is no more information there. There are also no errors in the event logs on the server.
Where else can I look to get a better idea of what is happening?
Thanks for any thoughts....
EDIT - Here is the web.config. As I said earlier, it is strange that it is working on another server. I checked to ensure are referenced assemblies are available (as according to the page here, it appear that may be the problem) in the gac.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\temp\;deleteAfterServicing=false;" />
</appSettings>
<connectionStrings>
<!-- removed for this post -->
</connectionStrings>
<system.data>
<DbProviderFactories>
<!--<add name="IBM Informix .NET Data Provider 3.0.0" invariant="IBM.Data.Informix.3.0.0" description="IBM Informix Data Provider 3.0.0 for .NET Framework 2.0" type="IBM.Data.Informix.IfxFactory, IBM.Data.Informix.3.0.0, Version=3.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208"/>-->
</DbProviderFactories>
</system.data>
<system.web>
<httpRuntime maxRequestLength="8192" />
<customErrors mode="Off" />
<sessionState timeout="360" />
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<namespaces>
<clear />
</namespaces>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /></assemblies></compilation>
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
</httpHandlers>
</system.web>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="5000000" />
</webServices>
</scripting>
</system.web.extensions>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ChartImageHandler" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
<defaultDocument>
<files>
<add value="index.aspx" />
</files>
</defaultDocument>
<tracing>
<traceFailedRequests>
<add path="*.aspx">
<traceAreas>
<add provider="ASP" verbosity="Verbose" />
<add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
<add provider="ISAPI Extension" verbosity="Verbose" />
<add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI" verbosity="Verbose" />
</traceAreas>
<failureDefinitions timeTaken="00:00:00" statusCodes="400-600" />
</add>
</traceFailedRequests>
</tracing>
</system.webServer>
</configuration>
It's a bit cheaty, but Microsoft has a page specifically about this problem ... and myriad suggestions for fixing it. Have you gone through it yet?
http://support.microsoft.com/kb/942055
Try this http://windowslivehelp.com/thread.aspx?threadid=3dd85141-a45d-44d9-a94c-3c7d13cfcd5c
I was able to get past this error by disabling compression that is applied by having wsus on the server.
See details here.
Thanks for everyone's help.

MSCharts "No http handler was found for request type 'GET'" error

I tried to install MSCharts on my Win2008 server.
It installed without problem.
Then I wrote
in config.
But when I'm trying to open page with charts it returned following error.
No http handler was found for request type 'GET'
Do you have any thougths about the problem?
This is what you need for ASP.NET 4.0 / IIS 7.5 on Windows 7:
Your web.config must contain the following:
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;" />
</appSettings>
<compilation targetFramework="4.0">
<assemblies>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
<system.webServer>
<handlers>
<add name="ChartImg" verb="*" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
You also need this at the top of your aspx page:
<%# Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
Hope this helps
Like Danil said, IIS7 requires that you put the handlers in
<system.webserver>
<handlers>
Add the two lines below after the last add-in handles
<add name="ChartImg" verb="*" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add name="ReportViewer" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler,Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Solution was in web config. IIS7 required to write handlers inside system.webserver but not in the system.web. So I just move handler and add name attribute as it became required.
Don't know anything about MSCharts, but I'd say try changing the AppPool for the app to 'Classic .NET AppPool'.
Alternatively, you may need to modify your web.config to add the handler in there. See Rick Strahl's post here.

Resources