Part 1Article: Typical use cases of WCF (Internet, lan, anonymous, etc.) Summary and examples of http://www.cnblogs.com/2018/archive/2011/02/26/1965569.html
This section describes how to use WCF by category. If the actual development involves deployment, select a deployment method based on the following information.
Deployment method: Self-bearer, IIS bearer, and appfabric bearer
IIS service bearer
Use SVC extension implementation, the following configuration
<Add Path = "*. SVC"
Verb = "*"
Type = "system. servicemodel. Activation. httphandler, system. servicemodel. activation, version = 4.0.0.0, culture = neutral, publickeytoken = 31bf3856ad364e35"
Validate = "false"/>
</Httphandlers>
How to enable IIS to host other protocols such as net. TCP
Two-step Configuration:
Adding net. TCP to website binding
Net. TCP added to supported protocols
Then the added SVC service automatically supports HTTP and net. TCP binding.
Manually set services without SVC files
<Servicehostingenvironment multiplesitebindingsenabled = "true">
<Serviceactivations>
<! -- A service without SVC must be enabled using the net. TCP protocol in IIS. -->
<Add relativeaddress = "demo. SVC" service = "wcfsvc. demowcf"/>
</Serviceactivations>
</Servicehostingenvironment>
<Services>
<Service name = "wcfsvc. demowcf">
<! -- Support different protocols for multiple endpoints -->
<Endpoint address = "ws" binding = "wshttpbinding" name = "HTTP" Contract = "contracts. icarrentalservice"/>
<Endpoint binding = "basichttpbinding" name = "HTTP" Contract = "contracts. icarrentalservice"/>
<Endpoint binding = "nettcpbinding" name = "TCP" Contract = "contracts. icarrentalservice"/>
</Service>
</Services>
<Behaviors>
<Servicebehaviors>
<Behavior>
<Servicemetadata httpgetenabled = "true"/>
</Behavior>
</Servicebehaviors>
</Behaviors
Hosting Selection
select the appropriate deployment method based on the preceding table.