找不到配置绑定扩展'system.serviceModel / bindings / clearUsernameBinding'

时间:2012-03-27 14:04:01

标签: wcf-security

嗨,我想使用这篇文章让我的wcf服务在没有SSL的情况下进行身份验证

http://webservices20.blogspot.in/2008/11/introducing-wcf-clearusernamebinding.html

但是当我尝试编译时,我正在解决这个错误:

<system.serviceModel>
<extensions>
  <bindingExtensions>
    <add name="clearUsernameBinding" type="ClearUsernameCollectionElement, ClearUsernameBinding" />
  </bindingExtensions>
</extensions>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior">
      <serviceCredentials>
        <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="MyValidator,App_Code"/>
      </serviceCredentials>

      <!--To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment-->
      <serviceMetadata httpsGetEnabled="true"/>
      <!--To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information-->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
    <behavior name="SampleServiceBehaviour">
      <serviceMetadata httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
      <serviceCredentials>
        <userNameAuthentication userNamePasswordValidationMode="Custom"
        customUserNamePasswordValidatorType="MyUserNameValidator, App_Code" />
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service name="Service" behaviorConfiguration="SampleServiceBehaviour">
    <endpoint address="~/QuadraService/Service.svc" binding="wsHttpBinding" contract="IService" bindingConfiguration="Binding1"/>
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
    <endpoint binding="clearUsernameBinding" bindingConfiguration="myClearUsernameBinding" contract="IService" />
  </service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<bindings>

  <clearUsernameBinding>
    <binding name="myClearUsernameBinding"
 messageVersion="Soap12">
    </binding>
  </clearUsernameBinding>

  <wsHttpBinding>

    <binding name="Binding1">
      <!-- UsernameToken over Transport Security -->
      <security mode="TransportWithMessageCredential" >
        <message clientCredentialType="UserName"/>
      </security>
    </binding>
  </wsHttpBinding>



</bindings>

 Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 
Parser Error Message: Configuration binding extension 'system.serviceModel/bindings/clearUsernameBinding' could not be found. Verify that this binding extension is properly registered in system.serviceModel/extensions/bindingExtensions and that it is spelled correctly.

请帮助

1 个答案:

答案 0 :(得分:0)

好像您正在收到&#34;验证邮件安全性时发生错误&#34;异常,因为您尚未手动修改客户端上的配置文件。

作者在评论中陈述如下:

  

对于桌面应用程序,客户端需要手动配置   clearUsernameBinding,如示例控制台应用程序中所做。该   原因是clearUsernameBinding dll不是.Net 3.5的一部分   并且需要在客户端部署。