ServiceModel Registration Tool (ServiceModelReg.exe)
This command-line tool provides the ability to manage the registration of WCF and WF components on a single machine. Under normal circumstances you should not need to use this tool as WCF and WF components are configured when installed. But if you are experiencing problems with service activation, you can try to register the components using this tool.
ServiceModelReg.exe[(-ia|-ua|-r)|((-i|-u) -c:<command>)] [-v|-q] [-nologo] [-?]
The tool can be found in the following location:
%SystemRoot%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\
When the ServiceModel Registration Tool is run on Windows Vista, the Windows Features dialog may not reflect that the Windows Communication Foundation HTTP Activation option under Microsoft .NET Framework 3.0 is turned on. The Windows Features dialog can be accessed by clicking Start, then click Run and then typing OptionalFeatures.
The following tables describe the options that can be used with ServiceModelReg.exe.
||Installs all WCF and WF components.|
||Uninstalls all WCF and WF components.|
||Repairs all WCF and WF components.|
||Installs WCF and WF components specified with –c.|
||Uninstalls WCF and WF components specified with –c.|
||Installs or uninstalls a component:
- httpnamespace – HTTP Namespace Reservation
- tcpportsharing – TCP port sharing service
- tcpactivation – TCP activation service (unsupported on .NET 4 Client Profile)
- namedpipeactivation – Named pipe activation service (unsupported on .NET 4 Client Profile
- msmqactivation – MSMQ activation service (unsupported on .NET 4 Client Profile
- etw – ETW event tracing manifests (Windows Vista or later)
||Quiet mode (only display error logging)|
||Suppresses the copyright and banner message.|
||Displays help text|
Fixing the FileLoadException Error
If you 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 is similar to the following.
Error: System.IO.FileLoadException: Could not load file or assembly 'System.ServiceModel, Version=18.104.22.168, 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=22.214.171.124, Culture=neutral, PublicKeyToken=b77a5c561934e089'
You should note from the error message that the System.ServiceModel Version 126.96.36.199 assembly was installed by an early Customer Technology Preview (CTP) release. The current version of the System.ServiceModel assembly released is 188.8.131.52 instead. Therefore, this issue is encountered 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.
If you are running WCF on a 64-bit machine, you should also edit the same file at this location.
Locate any XML nodes in this file that refer to "System.ServiceModel, Version=184.108.40.206", delete them and any child nodes. Save the file and re-run ServiceModelReg.exe resolves this problem.
The following examples show how to use the most common options of the ServiceModelReg.exe tool.
ServiceModelReg.exe -ia Installs all components ServiceModelReg.exe -i -c:httpnamespace -c:etw Installs HTTP namespace reservation and ETW manifests ServiceModelReg.exe -u -c:etw Uninstalls ETW manifests ServiceModelReg.exe -r Repairs an extended install