Where is the default protocol mapping stored in WCF

I want to change the http scheme binding from wsHttpBinding to wsHttpBinding . I know that I can override it in app.config . But for this you will need to change the setting in all hosted WCF applications.

I also could not find the protocol mapping section in the machine.config file.

The proton mapping by default is as follows.

 <protolMapping> <add scheme ="http" binding="basicHttpBinding" bindingConfiguration="" /> <add scheme ="tcp" binding="netTcpBinding" bindingConfiguration="" /> .. </protocolMapping> 

After the change, it should look.

 <protolMapping> <add scheme ="http" binding="wsHttpBinding" bindingConfiguration="" /> <add scheme ="tcp" binding="netTcpBinding" bindingConfiguration="" /> .. </protocolMapping> 
+4
source share
2 answers

I believe that the default values โ€‹โ€‹are implemented in the code, and not in the .config file, if you look at the ProtocolMappingSection Class , the InitializeDefault method with a tool such as a reflector or equivalent, you will see the following:

 protected override void InitializeDefault() { this.ProtocolMappingCollection.Add(new ProtocolMappingElement("http", "basicHttpBinding", "")); this.ProtocolMappingCollection.Add(new ProtocolMappingElement("net.tcp", "netTcpBinding", "")); this.ProtocolMappingCollection.Add(new ProtocolMappingElement("net.pipe", "netNamedPipeBinding", "")); this.ProtocolMappingCollection.Add(new ProtocolMappingElement("net.msmq", "netMsmqBinding", "")); } 
+1
source

The default settings are specified in the machine.config file and can be overwritten in the web.config / app.config file if they do not exist in the machine.config file, possibly because the server was not configured with WCF preinstalled. This will usually be installed and configured using IIS, but if IIS is not installed or is not used to host WCF, then the WCF function will not.

Related MSDN link

+1
source

All Articles