ServiceModel Registration Tool (ServiceModelReg.exe)

This command-line tool provides the ability to manage the registration of ServiceModel on a single machine.

                                    
                                    ServiceModelReg.exe [-i[r | ru] | -u | -ua | -r | -s:<path> | -sn:<path> | -k:<path> | -kn:<path> | -lv | -lk | -vi] [-q | -v] [-nologo] [-?]
                                

Remarks

The tool can be found in the following location

%SystemRoot%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\

The following tables describe the options that can be used with ServiceModelReg.exe.

Option Description

-i

Registers this version of WCF and update scriptmaps at the Internet Information Services (IIS) metabase root and for all scriptmaps under the root. Existing scriptmaps of lower versions are upgraded to this version.

-ir

Registers this version of WCF, register only. Do not install WCF scriptmaps in IIS.

-iru

Registers this version of WCF. If there are any existing applications that use WCF, do not update their scriptmaps in IIS.

-u

Un-registers this version of WCF. Existing scriptmaps to this version are remapped to highest remaining version of WCF installed on the machine.

-ua

Un-registers all versions of WCF on the machine.

-r

Re-registers this version of WCF and updates scriptmaps at the IIS metabase root and for all scriptmaps under the root. Existing scriptmaps are upgraded to this version regardless of the original versions.

-s:< path >

Registers scriptmaps for this version of WCF at the specified path, recursively.

-sn:< path >

Registers scriptmaps for this version of WCF at the specified path, non-recursively.

-k:< path >

Removes all scriptmaps to any version of WCF from the specified path, recursively.

-kn:< path >

Removes all scriptmaps to any version WCF from the specified path, non-recursively.

-lv

Lists all versions of WCF that are registered on the machine, with status and installation path.

-lk

Lists the paths of all IIS metabase keys where WCF is scriptmapped, together with the version. Keys that inherit WCF scriptmaps from a parent key are not displayed.

-vi

Verifies the installation of target components and generates a report. Components can be in the following states: unknown, not installed, installed default, or installed custom.

-y

Do not ask for confirmation before registering or re-registering components.

-q

Quiet mode (reduced output).

-v

Verbose mode.

-nologo

Suppresses the copyright and banner message.

Fixing the FileLoadException Error

If you have installed previous versions of WCF on your machine, you may get a FileLoadFoundException error when you run the ServiceModelReg tool to register a new installation. This can happen even if you have manually removed files from the previous install, but left the machine.config settings intact.

The error message you get is similar to the following.

Error: System.IO.FileLoadException: Could not load file or assembly 'System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

You should note from the error message that the System.ServiceModel Version 2.0.0.0 assembly was installed by an early CTP (Customer Technology Preview) release. The current version of the System.ServiceModel assembly released is 3.0.0.0 instead. Therefore, you will encounter this issue when you want to install the official WCF release on a machine where an early CTP release of WCF was installed, but not completely uninstalled.

ServiceModelReg.exe cannot clean up prior version entries, nor can it register the new version's entries. The only workaround is to manually edit machine.config. You can locate this file at the following location.

%windir%\Microsoft.NET\Framework\v2.0.50727\config\machine.config

If you are running WCF on a 64-bit machine, you should also edit the same file at

%windir%\Microsoft.NET\Framework64\v2.0.50727\config\machine.config

Locate any XML nodes in this file that refer to “System.ServiceModel, Version=2.0.0.0”, delete them and any child nodes. Save the file and re-run ServiceModelReg.exe will resolve this problem.

'

Examples

The following examples show how to use the -s and -k options of the ServiceModelReg.exe tool.

ServiceModelReg.exe -s:W3SVC/1/ROOT/SampleApp1
ServiceModelReg.exe -k:W3SVC/1/ROOT/SampleApp1

Footer image

Send comments about this topic to Microsoft.
© Microsoft Corporation. All rights reserved.