0

我已经在 Windows 服务中托管了我的 Wcf 服务,我可以在我的测试控制台应用程序中毫无问题地使用它,但是当我尝试通过在我的 silverlight 应用程序中使用服务引用来使用相同的服务时,它给了我错误。

ServiceReferences.ClientConfig 有这个条目:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        ...
      </netTcpBinding>
    </bindings>
    <client>
      <endpoint address="net.tcp://localhost:8732/myservices/myservice/"
          binding="netTcpBinding" bindingConfiguration="NetTcpBinding_myservice"
          contract="ServiceReference1.myservice" name="NetTcpBinding_myservice">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>
</configuration>

我收到此错误:服务参考配置中无法识别元素“netTcpBinding”。请注意,Silverlight 中只有一部分 Windows Communication Foundation 配置功能可用。将感谢您的帮助..

阿尔卑斯山

4

1 回答 1

0

Have you Installed WCF Non-HTTP Activation on your IIS?

Found this rather good article on using NetTcpBinding with WCF and Silverlight: http://www.codeproject.com/Articles/311250/NetTcpBinding-Configurations-for-WCF-and-Silverlig

The other thing I noted is that apparently you can't specify security options with Silverlight and netTcp, so have to specify an insecure binding (from that same example):

<bindings>
      <netTcpBinding>
        <binding name="InsecureTcp" receiveTimeout="Infinite">
          <security mode="None"/>                                    
        </binding>                                                   
      </netTcpBinding>
</bindings>
于 2012-06-21T14:37:20.537 回答