1

由于 WPF 4 提供了开箱即用的默认配置,因此我很难尝试为我的服务创建自定义 MTOM 绑定。简而言之,我的 WCF 库托管了几个使用基本 HTTP 的服务。其中一项服务用于文件上传,需要 MTOM。我该怎么做才能让我的文件上传服务使用自定义定义的 MTOM 绑定,而其余的使用默认绑定?

这是我到目前为止所拥有的:

<bindings>
  <basicHttpBinding>
    <binding
      name="FileTransferBinding"
      transferMode="Streamed"
      messageEncoding="Mtom"
      maxBufferSize="65536"
      maxReceivedMessageSize="10485760">
    </binding>
  </basicHttpBinding>
</bindings>
<services>
  <service name="FileTransferService">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="FileTransferBinding" contract="MyServices.IFileTransfer"/>
  </service>
</services>

提前致谢!

4

1 回答 1

1

为了配置服务,<service>元素中的服务名称需要是实现服务的类的类型完全限定名称,以便识别正在管理配置的服务。

<service name="MyNamcespace.FileTransferService">

服务元素MSDN:

Name :必需的 String 属性,指定要实例化的服务的类型。此设置必须等同于有效类型。格式应为 Namespace.Class。

于 2011-02-04T22:43:21.680 回答