One: Build a simple WCF project, as well as the IIS service configuration, publish the project, step
II: Web. config configuration
<?xml version="1.0"encoding="Utf-8"?><configuration> <appSettings> <add key="Aspnet:usetaskfriendlysynchronizationcontext"Value="true"/> </appSettings> <system.web> <compilation debug="true"targetframework="4.5"/> "4.5"/> </system.web> <system.serviceModel>
<services> <service name="Tcpwcf.service1"> <endpoint binding="nettcpbinding"address=""contract="Tcpwcf.iservice1"/> <endpoint address="Mex"binding="mextcpbinding"contract="IMetadataExchange"/> "net.tcp://localhost:7878/service1.svc"/> </baseAddresses> "true"></binding> </netTcpBinding> </bindings>
<behaviors> <serviceBehaviors> <behavior> <!--to avoid leaking metadata information, set the following values before deployment tofalse-"Need to be modified"<servicemetadata httpgetenabled="false"Httpsgetenabled="false"/> <!--to receive the fault exception details for debugging, set the following values totrue。 Before deployment, set tofalseTo avoid leaking exception information--<servicedebug includeexceptiondetailinfaults="false"/>"Need to be modified"
</behavior> </serviceBehaviors> </behaviors> <protocolMapping> <add binding="basichttpsbinding"Scheme="HTTPS"/> </protocolMapping> <servicehostingenvironment aspnetcompatibilityenabled="true"Multiplesitebindingsenabled="true"/> </system.serviceModel> <system.webServer> <modules runallmanagedmodulesforallrequests="true"/> <directorybrowse enabled="true"/> </system.webServer> </configuration>
Three: Site Configuration when publishing
Four: Post-release results
Five: Client-side reference, need to refer to several times.
WCF Non-HTTP Homestay IIS