发现WCF托管的Windows服务

问题描述:

在上述方案中,4个项目:业务时,WCFService和WCFServiceHost(窗口服务)和客户端发现WCF托管的Windows服务

当我在解决方案的工作,没问题,我可以发现和创造客户端中的代理。

当我安装主机服务,从我做起,但不可能发现和创造这从Visual Studio代理:的net.tcp://本地主机:9100/MyApplicationWcf

任何想法?

谢谢,使用mexTcpBinding

更新#1

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.serviceModel> 
    <services> 
     <service name="MyApplicationWcf.MyClassWcf"> 
     <endpoint address="net.tcp://localhost:9100/MyClassWcf" 
        binding="netTcpBinding" 
        bindingConfiguration="" 
        name="MyClassWcf_Tcp" 
        contract="MyApplicationWcf.MyClassWcf" /> 

     <endpoint name="mexHttpBinding" 
        contract="IMetadataExchange" 
        binding="mexHttpBinding" 
        address="mex" /> 
     </service>  
    </services>  
    </system.serviceModel> 
</configuration> 
+1

你能显示服务的配置文件吗?你从哪里尝试去做? net.tcp:// localhost:9100/MyApplicationWcf将您连接到您尝试访问的计算机,因为“localhost”。 – Kangkan 2010-11-25 08:33:47

+0

我会做,重新开始。空白的解决方案,当我尝试“添加服务引用”anyhting在结果 – 2010-11-25 09:03:36

如果你想发现过的net.tcp的服务,您需要定义一个MEX端点(元数据交换)。

<behaviors> 
    <serviceBehaviors> 
     <behavior name="MexBehavior" > 
     <serviceMetadata/>        
     </behavior> 
    </serviceBehaviors> 
</behaviors>  
<bindings> 
    <netTcpBinding> 
     <binding name="mexBinding" portSharingEnabled="true"> 
      <security mode="None"></security> 
     </binding> 
    </netTcpBinding>  
</bindings> 
<services> 
    <service name="YourServiceImpl" 
      behaviorConfiguration="MexBehavior">     
     <host> 
     <baseAddresses> 
      <add baseAddress ="net.tcp://localhost:9100/MyApplicationWcf/"/> 
     </baseAddresses> 
     </host> 
     <endpoint address="" 
       binding="netTcpBinding" 
       contract="IYourServiceContract" /> 
     <endpoint address="mex" 
       binding="mexTcpBinding" bindingConfiguration="mexBinding" 
       contract="IMetadataExchange" /> 
    </service> 
</services> 

你有吗?

查看:How to: Publish Metadata for a Service Using a Configuration File了解更多信息。