原本WCF只使用了< BasicHttpBinding >,现在新增net.tcp协议,添加后服务器报错找不到具有绑定 NetTcpBinding 的终结点的与方案 net.tcp 匹配的基址。注册的基址方案是 [http]。,检查Web.config与网站配置之后依旧报错。
最后参照 WCF:如何将net.tcp协议寄宿到IIS,在网站->绑定->添加net.tcp协议 ,情况解决。


如果刚开始配置,不要忘记在高级设置中增加net.tcp协议

Web.config配置文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| <?xml version="1.0" encoding="utf-8"?> <configuration>
<appSettings> <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/> </appSettings> <system.web> <compilation debug="true" targetFramework="4.6.1"/> <httpRuntime targetFramework="4.6.1"/> </system.web> <system.serviceModel> <bindings> <netTcpBinding> <binding name="NetTcpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" sendTimeout="00:30:00" transferMode="Streamed"> <security mode="None"/> </binding> </netTcpBinding> </bindings>
<services> <service name="WcfMySqlService.MysqlInfo"> <endpoint address="" binding="netTcpBinding" bindingConfiguration="NetTcpBinding" contract="WcfMySqlService.IMysqlInfo"> <identity> <dns value="localhost"/> </identity> </endpoint> <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/> <host> <baseAddresses> <add baseAddress="http://localhost:8084/WcfMysqlService/MysqlInfo.svc"/> <add baseAddress="net.tcp://localhost:8084/WcfMysqlService/MysqlInfo.svc"/> </baseAddresses> </host> </service> </services>
<behaviors> <serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> <protocolMapping> <add binding="basicHttpsBinding" scheme="https"/> <add scheme="net.tcp" binding="netTcpBinding" /> </protocolMapping> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/> </system.webServer>
<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Buffers" publicKeyToken="CC7B13FFCD2DDD51" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration>
|