我有WCF和net.tcp綁定的常見問題。 我看到所有帖子在stackoverflow也googling ..在WCF中添加服務引用時找不到net.tcp端點?
我不能添加服務引用到我的客戶端的主要問題。 我得到錯誤:
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個地址開始,但在的net.tcp綁定IIS我加60746:* 我也開入站出站規則,兩個端口。
謝謝!
您的IIS服務器上的Windows功能中是否啓用了「Windows Communication Foundation非HTTP激活」功能? –
是的。我啓用它。 – user1711993
如果您的程序是.NET 4.5,您是否已經在.NET Framework 4.5高級服務中啓用了TCP激活(如果您的操作系統正在運行IIS) –