Why is ServiceModel sometimes declared in Framework folder's Web.config and sometimes not?

5

We're deploying an ASP.NET 4.0 web application that has this declaration in the <httpModules> section of its Web.config file:

<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler"/>

On most installations, this is both fine and necessary. However, on two installations we got the below error about duplicate entries. In the two installations that had this error, we found this declaration already existed here:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config

The installations that do not have the error, most installations, don't have that line in the above file. Why is the Framework's Web.config file inconsistent across installations? We haven't been able to identify the exact difference yet. These are are mostly servers with either Windows Server 2003 or Windows Server 2008 but also some test boxes with Windows 7. The working installations are a mix of the above, the two non-working ones are Windows Server 2008 and Windows 7. All installations have .NET 4 Full Profile installed.

Detailed Error Information

Module IIS Web Core

Notification BeginRequest

Handler Not yet determined

Error Code 0x800700b7

Config Error Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'ServiceModel'

Config File \\?\C:\Inetpub\wwwroot\web.config Requested URL http://localhost:80/ Physical Path C:\Inetpub\wwwroot Logon Method Not yet determined Logon User Not yet determined

98: <add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler"/>

asp.net
web-config
asked on Stack Overflow Jan 13, 2012 by Samuel Neff • edited Jun 20, 2020 by Community

1 Answer

3

That module is installed (into the base .NET Framework config file) when you enable the following Windows Feature:

Microsoft .NET Framework 3.5.1 -> Windows Communication Foundation HTTP Activation

When you enable WCF HTTP Activation it registers WCF with IIS. This includes adding the WCF Activation module, adding the script mapping for .svc files, etc.

answered on Stack Overflow Nov 11, 2012 by Matt Varblow

User contributions licensed under CC BY-SA 3.0