[英]Can't find net.tcp endpoint in add service reference in WCF?
我有WCF和net.tcp綁定的常見問題。 我看到stackoverflow上的所有帖子也谷歌搜索..
我無法向客戶端添加服務引用的主要問題。 我收到錯誤:
Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].
我正在使用IIS 7.我檢查了非HTTP.I添加到啟用協議net.tcp的網站,還將net.tcp添加到綁定。 如果我點擊瀏覽(http)我的地址。 我看到我的文件夾與WCF應用程序,如果我選擇svc文件,我看到正常的地址:
svcutil.exe net.tcp://MYADDRESS/Service.svc/mex
我想如果我看到這個URL我正確設置了我的IIS !!
但是當我嘗試添加對客戶端的引用時問題就開始了。 只有我看到http端點而沒有net.tcp。
這是我的服務配置:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<services>
<service name="MYSERVICE.SERVICE" behaviorConfiguration="behavior1">
<endpoint
binding="netTcpBinding"
contract="MYSERVICE.ISERVICE">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:60745/MYSERVICE/SERVICE/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="behavior1">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="netTcpBinding" scheme="net.tcp" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
注意:我的網站從60745地址開始,但是對於IIS中的net.tcp綁定,我添加了60746:*我也打開了兩個端口的入站出站規則。
謝謝!
從您在評論中提到的問題來看,我自己也運行它,添加服務引用的gui也不能很好地處理mexTcpBinding
。
您可以將HTTP mex用於元數據,並仍然使用net.tcp作為數據通道。 以下是我的一個使用帶有http mex的tcp通道的項目的示例。
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpConfig" closeTimeout="00:30:00" openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00" transferMode="Streamed"
maxReceivedMessageSize="67108864">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="AsyncStreaming">
<dispatcherSynchronization asynchronousSendEnabled="true"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceCredentials>
<serviceCertificate findValue="Example" x509FindType="FindBySubjectName"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Server.Endpoints.ExampleEndpoint">
<endpoint address="" behaviorConfiguration="AsyncStreaming" binding="netTcpBinding" bindingConfiguration="NetTcpConfig" contract="Server.IExample"/>
<endpoint address="" behaviorConfiguration="AsyncStreaming" binding="netTcpBinding" bindingConfiguration="NetTcpConfig" contract="Server.IExample2"/>
<endpoint address="" behaviorConfiguration="AsyncStreaming" binding="netTcpBinding" bindingConfiguration="NetTcpConfig" contract="Server.IExample3"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<protocolMapping>
<add binding="netTcpBinding" scheme="net.tcp" bindingConfiguration="NetTcpConfig"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<diagnostics wmiProviderEnabled="false">
<messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"
maxMessagesToLog="3000"/>
</diagnostics>
</system.serviceModel>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.