无法识别的属性' defaultAlgorithmSuite'

时间:2016-04-26 14:04:51

标签: c# web-services wcf

我尝试创建Web服务客户端实例后收到异常。消息是"无法识别的属性' defaultAlgorithmSuite'。请注意,属性名称区分大小写"。该应用程序是从Visual Studio 2015在IIS Express中调试的.NET Framework 4.5上的MVC 5.相同的代码在具有相同属性的另一个应用程序中工作。 Web.config中的语法验证无法识别服务绑定配置中的标记安全性中的属性。

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_MaxValueRecovery" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000">
          <readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000" />
        </binding>
        <binding name="CustomBinding_IMyService">
          <security defaultAlgorithmSuite="Default"
                    authenticationMode="UserNameOverTransport"
                    requireDerivedKeys="true"
                    includeTimestamp="true"
                    messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"
                    allowInsecureTransport="true"
                    enableUnsecuredResponse="true">
            <localClientSettings detectReplays="false" />
            <localServiceSettings detectReplays="false" />
          </security>
          <textMessageEncoding messageVersion="Soap12" />
          <httpTransport />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://.../MyService.svc"
            binding="customBinding" bindingConfiguration="CustomBinding_IMyService"
            contract="MyNamespace.IMyService" name="CustomBinding_IMyService" />
    </client>
</system.serviceModel>

我错过了什么或做错了什么?谢谢......

1 个答案:

答案 0 :(得分:1)

您不小心尝试将自定义绑定配置为BasicHttpBinding。移动

<binding name="CustomBinding_IMyService"> ... </binding>

阻止<basicHttpBinding>以及<customBinding>父母:

<bindings>
    <basicHttpBinding>
        <binding name="BasicHttpBinding_MaxValueRecovery" ...>
        ...
        </binding>
    </basicHttpBinding>
    <customBinding>
        <binding name="CustomBinding_IMyService">
        ...
        </binding>
    </customBinding>
</bindings>

您要配置的安全选项are only supported on a custom binding