IIS 7.5 'protocolMapping' cannot be read error in web.config - asp.net

When I want to just simply open an application's web.config file (IIS 7.5, Windows 7 x64) or make some changes to it using PowerShell commands, which not necessary has to do anything with the 'protocolMapping' section, the following error is thrown: "Error: The configuration section 'protocolMapping' cannot be read because it is missing a section declaration".
The exact same commands are working perfectly on IIS 8, but I need this to work in IIS 7.5 too. What can be the problem?
Things I've already tried, and do NOT solves the problem:
the applicationPool's framework, under the application is running, is set to v4.0
also the DefaultAppPool is set to v4.0 framework (however the application has a separate applicationPool)
[UPDATE]
This error comes up on multiple machines, running Windows 7 (32 and 64 bit too), even on a fresh install of Windows 7.

Try to put on web.config section this:
<configSections>
<sectionGroup name="system.serviceModel" type="System.ServiceModel.Configuration.ServiceModelSectionGroup, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="protocolMapping" type="System.ServiceModel.Configuration.ProtocolMappingSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
</configSections>
This solved for me

The error is generating from a misconfiguration in either web.config or applicationhost.config. It's mentioning protocol bindings so you're going to have to start trouble shooting the site bindings either through the gui or (more likely) manually editing the files. I'd start by comparing that section from a working site.

Related

How to reinstall or just make Application Request routing module show in IIS Manager console

I need to reinstall IIS, and I noticed application requset routing module is not shown in IIS manager. I decided to install in using Web platform installer but inside there it says I have module installed which is true when I go to C:\Program Files\IIS I can see folder "Application Request Routing" there but why IIS can't see it now. Using web platform installer is not possible to uninstall or reinstall module.
It was not easy but important files are: administration.config and applicationHost.config file inside C:\Windows\System32\inetsrv\config
folder. Inside administration.config file, inside moduleProviders section I had to add :
<add name="WebFarmFramework" type="Microsoft.Web.Management.WebFarm.WebFarmModuleProvider, Microsoft.Web.Management.WebFarm, Version=7.1.2.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ApplicationRequestRouting" type="Microsoft.Web.Management.Arr.ArrModuleProvider, Microsoft.Web.Management.Arr, Version=7.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
That made Application request module show in IIS manager. After I opened it showed errors but errors are easy to understand. I needed to make same changes inside application.config file, inside configSection section:
<section name="diskCache" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
<section name="proxy" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
These are changes I made to those files recently but there are probably few other sections I had to add inside application.config file, but idea was to copy those sections from some other computer which has good configuration.

Crystal Report Not Displyed on IIS window Server 2008 R2

i create ASP.NET Website using visual studio 2010 using SAP Crystal Report Everythings work fine on Viusal Studio but when i move my Site to IIS Crystal Report is Not Work and No Error MEssage is Generated
Crystal Report Version 13
Visual Studio 2010
IIS 7 on 64 bit Server 2008R2
You Need to check:
1- Application pool .NET version it must be 4
2- From Pages and Controls >> Compilation Mode >> Always
3- Installation of the report viewer if not installed (client)
Kindly check:
1. C:\Windows\assembly
file
if exist your CR Runtime installation is ok
2. Check IIS, Set "Enable 32 bit Application" to False
then Test your web site, If IIS Application Pool Stopping
follow this https://community.ipswitch.com/s/article/ka036000000Jvd1AAC/Error-503-DefaultAppPool-stopping-HipIISEngineStub-dll-failed-to-load-The-data-is-the-error
In IIS 7.5 or higher version cant read **crystalreportviewer13** .so some times we need to update manually also.
and
Update your **web config** file in your web's root directory.add the following code..
<configuration>
<configSections>
<sectionGroup name="businessObjects">
<sectionGroup name="crystalReports">
<section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
</sectionGroup>
</configSections>
<businessObjects>
<crystalReports>
<crystalReportViewer>
***<add key="UseBrowserLocale" value="true"/>
<add key="resourceURI" value="~/aspnet_client/system_web/4_0_30319/crystalreportviewers13" />***
<add key="documentView" value="weblayout" />
</crystalReportViewer>
</crystalReports>
</businessObjects>

URL Rerouting failing on IIS 7 do i need to add any configuration to set it up?

URL Rerouting failing on IIS 7 do i need to add any configuration to set it up ?
I was previously using IIS 6 and did not specify any configuration settings. My app is built on asp.net 4.0. I tried to add the following config but still it failed.
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="RoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
Please make sure that you are running under IIS 7.0 Integrated mode. If you need to run it under IIS 7.0 Classic mode, you need to perform several actions to make the routes work. Please refer the following blog posts;
http://www.tugberkugurlu.com/archive/running-asp-net-mvc-under-iis-6-0-and-iis-7-0-classic-mode---solution-to-routing-problem
http://www.tugberkugurlu.com/archive/deployment-of-asp-net-mvc-3-rc-2-application-on-a-shared-hosting-environment-without-begging-the-hosting-company

Could not load type 'System.ServiceModel.Activation.HttpHandler' Version conflict with WCF REST

I've run into a problem with WCF REST Service. I get:
Could not load type 'System.ServiceModel.Activation.HttpHandler' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
when running inside of the IIS in an ASP.NET 4.0 AppPool.
The problem seems to occur only if:
Running inside of IIS
When ASP.NET Comaptibility is enabled
Running in Cassini - no problem it works properly. Running with ASP.NET compatibility off - no problem it works.
It appears that it's some sort of handler version conflict trying to instantiate the wrong version of the handler that in turn tries to load an older version of System.ServiceModel, but I haven't been able to trace this down.
Anybody seen anything like this before and have any ideas how to track this down further?
I've looked in ApplicationHost.config and the master web.config files for System.ServiceModel and HttpHandler references but no luck. There.
+++ Rick ---
fire up your Visual Studio 2010 Command Prompt or browse to "C:\Windows\Microsoft.NET\Framework\ v4.0.30319". And run the following command from the command prompt:
aspnet_regiis.exe -iru
This will register latest .net version. Also make sure your app pool is running latest version of .net
So as expected this turned out to be a versioning conflict in the default handler mappings in ApplicationHost.config. Specifically IIS has mappings for ASP.NET 2.0 and ASP.NET 4.0 specific references to the service activation handler (and module) and the 2.0 references weren't restricted by a version specific preCondition.
To fix the above problem I had to change (at the System root in ApplicationHost.config):
<add name="svc-Integrated" path="*.svc" verb="*"
type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
preCondition="integratedMode" />
to:
<add name="svc-Integrated" path="*.svc" verb="*"
type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
preCondition="integratedMode,runtimeVersionv2.0" />
Note the EXPLICIT runtimeVersion2.0. There are additional *.svc maps in the same section for the runtimeVersion4.0 which then fire the appropriate runtimes.
According to Microsoft this situation can arise when some older tools (I'm guessing Azure tools???) are installed that don't register the runtime version properly.
Problem solved.
There is one more way if all of above doesn't work. (Strange)
We were using Windows Server 2008 R2 SP1 with IIS 7.5.7600
After registering latest framework as given in above answer,
You need to the add handler mapping to v.4.0 assembly manually to web.config and remove "ServiceModel" from Modules.
<system.webServer>
<handlers>
<remove name="svc-Integrated" />
<add name=".svc" verb="*" path="*.svc" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory,
System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
<modules>
<remove name="ServiceModel" />
</modules>
</system.webServer>
More here

visual studio 2k8 (and 2k10) cannot compile web application when gac assemblies are moved into global web.config

I have numerous ASP.NET 3.5 web applications with verbose application-level web.config files which I wish to slim down and make more readable.
Visual Studio 2010 has just arrived and has already started "cleaning up" various sections of the web.config - so now is a perfect time for me to continue the good work and do the same in other areas of the web.config file.
Currently I have several third party assemblies all happily registered in the GAC, these are then referenced in each application-level Web.Config see below;
<configuration>
<system.web>
<compilation defaultLanguage="C#" debug="true">
<assemblies>
<add assembly="AjaxControlToolkit, Version=3.0.30512.20315, Culture=neutral, PublicKeyToken=28F01B0E84B6D53E"/>
<add assembly="aspNetEmail, Version=3.5.2.0, Culture=neutral, PublicKeyToken=BC571E8DA1C1F543"/>
<add assembly="aspNetDns, Version=3.0.0.0, Culture=neutral, PublicKeyToken=BC571E8DA1C1F543"/>
<add assembly="Microsoft.Practices.EnterpriseLibrary.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="Microsoft.Practices.EnterpriseLibrary.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
</system.web>
</configuration>
I have moved the above compilation-node into the global web.config file located at Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config - and the application runs just fine under IIS7 i.e. the application has no trouble finding these GAC'd assemblies.
however when I now compile (shift+ctrl+b) my web application in visual studio 2k8 or 2k10 I'm getting the familiar error "The type or namespace name 'aspNetDns' could not be found (are you missing a using directive or an assembly reference?)"
What do I have to do to get visual studio to recognise the whereabouts of these GAC'd libraries? I tried copying them into windows\system32 but no joy there...
help! :)
NB: I have also tried working with the machine.config but still no luck
Solved it.
I needed to edit the global web.config in the x86 directory (as well as the x64 version) - the x86 version is obviously the one Visual Studio was looking at whilst compiling the app, whereas IIS was looking at the x64 version of the global web.config when running the app.
Drag / drop the assemblies to c:\windows\assembly on your local machine where you are recompiling.

Resources