FIX: Servicing a Microsoft .NET Framework 4.0 component will trigger a repair of Net.TCP Port Sharing Service and change the NET.TCP port bindings in IIS Configuration

Article ID: 2505290 - View products that this article applies to.
Expand all | Collapse all

On This Page

SYMPTOMS

When you install a hotfix that updates any Microsoft .NET Framework 4.0 component (say for example, MS10-77), you might see your existing NET.TCP bindings in Internet Information Services (IIS) configuration getting changed to the default port 808 instead of your custom port.

CAUSE

This is a known issue in the .NET framework 4.0 servicing for its sub component which is Net.TCP Port Sharing Service. When you install a hotfix that updates any Microsoft .NET Framework 4.0 component, the patched component will trigger a repair of the entire .NET feature set. When the feature set is repaired, it will repair all sub-features and their dependencies as well. Since Net.TCP Port Sharing Service is part of the .NET Framework 4.0 feature set, a feature set repair for the updated .NET framework 4.0 component will trigger all of the custom actions associated with Net.TCP Port Sharing Service as well. Even if the .NET hotfix does not directly update Net.TCP Port Sharing Service OR IIS binaries, it will still trigger a repair of the WCF Net.TCP Port Sharing Service by executing ServiceModelReg.exe. This will re-configure the Net.TCP Port Sharing service, along with NetTcpActivator service, NetMsmqActivator service and NetPipeActivator service. 

Re-configuring Net.TCP Port Sharing service changes the port back to default value of 808.

RESOLUTION

Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that described in this article. Apply this hotfix only to systems that are experiencing the problem described in this article. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft website:
http://support.microsoft.com/contactus/?ws=support
Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

Prerequisites

To apply this hotfix, you must have the .NET Framework 4 installed.

Registry information

To use the hotfix in this package, you do not have to make any changes to the registry.

Restart requirement

You have to restart the computer if ServiceModel Registration Tool is being used when you apply this hotfix. To avoid a restart, do not attempt to use ServiceModelReg.exe while the hotfix is being applied.

Hotfix replacement information

This hotfix does not replace a previously released hotfix.

File information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
For all supported x86-based versions of the .NET Framework 4 for Windows Server 2003, for Windows XP, for Windows Vista, for Windows Server 2008, or for Windows 7, or for Windows Server 2008 R2
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Servicemodelreg.exe4.0.30319.525192,79203-Nov- 201106:51x86
For all supported x64-based versions of the .NET Framework 4 for Windows Server 2003, for Windows XP, for Windows Vista, for Windows Server 2008, or for Windows 7, or for Windows Server 2008 R2
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Servicemodelreg.exe4.0.30319.525192,79203-Nov- 201106:51x86
Servicemodelreg.exe4.0.30319.525261,91203-Nov-201107:53x64
For all supported IA64-based versions of the .NET Framework 4 for Windows Server 2003, for Windows XP, for Windows Vista, for Windows Server 2008, or for Windows 7, or for Windows Server 2008 R2
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Servicemodelreg.exe4.0.30319.525192,79203-Nov- 201106:51x86
Servicemodelreg.exe4.0.30319.525545,56003-Nov-201108:46IA-64


WORKAROUND

To work around the issue, manually change the NET.TCP bindings in the Internet Information Services (IIS) configuration to your custom port. 

MORE INFORMATION

NOTE:You can also back up your applicationHost.config file (C:\windows\system32\inetsrv\config folder) before installing the patch and then replace it after installing the patch.

You can also use the script, code, OR command line (pick one - listed below), to automate reverting the bindings back to your custom port.

Please note that following methods assumes that the name of the website in question is Default Web Site and the custom Port is 12345. Please change it to appropriate name and port as needed.


JavaScript
~~~~~~~~
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";

var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST");

var sitesCollection = sitesSection.Collection;

var siteElementPos = FindElement(sitesCollection, "site", ["name", "Default Web Site"]);
if (siteElementPos == -1) throw "Element not found!";
var siteElement = sitesCollection.Item(siteElementPos);

var bindingsCollection = siteElement.ChildElements.Item("bindings").Collection;

var bindingElementPos = FindElement(bindingsCollection, "binding", ["protocol", "net.tcp","bindingInformation", "57244:*"]);
if (bindingElementPos == -1) throw "Element not found!";
var bindingElement = bindingsCollection.Item(bindingElementPos);

bindingElement.Properties.Item("bindingInformation").Value = "12345:*";

adminManager.CommitChanges();

function FindElement(collection, elementTagName, valuesToMatch) {
for (var i = 0; i < collection.Count; i++) {
var element = collection.Item(i);

if (element.Name == elementTagName) {
var matches = true;
for (var iVal = 0; iVal < valuesToMatch.length; iVal += 2) {
var property = element.GetPropertyByName(valuesToMatch[iVal]);
var value = property.Value;
if (value != null) {
value = value.toString();
}
if (value != valuesToMatch[iVal + 1]) {
matches = false;
break;
}
}
if (matches) {
return i;
}
}
}

return -1;
}


Managed C# code
~~~~~~~~~~~~~
using System;
using System.Text;
using Microsoft.Web.Administration;

internal static class Sample {

private static void Main() {

using(ServerManager serverManager = new ServerManager()) {
Configuration config = serverManager.GetApplicationHostConfiguration();

ConfigurationSection sitesSection = config.GetSection("system.applicationHost/sites");

ConfigurationElementCollection sitesCollection = sitesSection.GetCollection();

ConfigurationElement siteElement = FindElement(sitesCollection, "site", "name", @"Default Web Site");
if (siteElement == null) throw new InvalidOperationException("Element not found!");


ConfigurationElementCollection bindingsCollection = siteElement.GetCollection("bindings");

ConfigurationElement bindingElement = FindElement(bindingsCollection, "binding", "protocol", @"net.tcp", "bindingInformation", @"57244:*");
if (bindingElement == null) throw new InvalidOperationException("Element not found!");

bindingElement["bindingInformation"] = @"12345:*";

serverManager.CommitChanges();
}
}

private static ConfigurationElement FindElement(ConfigurationElementCollection collection, string elementTagName, params string[] keyValues) {
foreach (ConfigurationElement element in collection) {
if (String.Equals(element.ElementTagName, elementTagName, StringComparison.OrdinalIgnoreCase)) {
bool matches = true;

for (int i = 0; i < keyValues.Length; i += 2) {
object o = element.GetAttributeValue(keyValues[i]);
string value = null;
if (o != null) {
value = o.ToString();
}

if (!String.Equals(value, keyValues[i + 1], StringComparison.OrdinalIgnoreCase)) {
matches = false;
break;
}
}
if (matches) {
return element;
}
}
}
return null;
}
}


APPCMD
~~~~~
appcmd.exe set config -section:system.applicationHost/sites /[name='MySite'].bindings.[protocol='net.tcp',bindingInformation='57244:*'].bindingInformation:"12345:*" /commit:apphost

NOTE: When you use above specific APPCMD command and the name of your web site has a spce in it (like Default Web Site), it is neccessary that you encapsulate the name in double quotes. For example, '"Default Web Site"'

REFERENCES

For more information about Net.TCP Port Sharing, visit the following Microsoft website:
http://msdn.microsoft.com/en-us/library/ms734772.aspx

For more information about ServiceModel Registration Tool (ServiceModelReg.exe), visit the following Microsoft website:
http://msdn.microsoft.com/en-us/library/ms732012.aspx

Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.

Properties

Article ID: 2505290 - Last Review: December 6, 2011 - Revision: 4.0
APPLIES TO
  • Microsoft Internet Information Services 6.0
  • Microsoft Internet Information Services 7.0
  • Microsoft Internet Information Services 7.5
  • Windows Communication Foundation 4
Keywords: 
kbqfe kbhotfixserver kbfix KB2505290

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com