更改EndpointAddress后发生ActionNotSupportedException

时间:2015-06-01 07:06:21

标签: c# wcf silverlight silverlight-5.0 wcf-binding

我正在使用WCF和Silverlight。我想用动态代码更改EndpointAddress:

EndpointAddress endpointAdress = new EndpointAddress(serviceUrl);
var proxy = new ServerConnectionClient(context);
proxy.Endpoint.Address = endpointAdress;

连接打开成功,但在调用后,服务中的方法发生了ActionNotSupportedException。

  

的Web.config

<configuration>
  <system.serviceModel>
    <bindings>
      <customBinding>
        <binding name="NetTcpBinding">
          <binaryMessageEncoding />
          <tcpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
        </binding>
      </customBinding>
    </bindings>
    <client>
      <endpoint address="net.tcp://MyIpAddress:4502/engine/net" binding="customBinding"
        bindingConfiguration="NetTcpBinding" contract="CTMSConnection.IServerConnection"
        name="NetTcpBinding" />
    </client>
  </system.serviceModel>
</configuration>

添加服务参考后生成的以上配置。

问题在哪里?

1 个答案:

答案 0 :(得分:1)

这很容易。 您必须生成与POS system extension for magento with XML 完全相同的代码。

您必须使用以下代码:

Web.Config