【问题标题】:how to add bindingExtensions in webconfig?如何在 Web 配置中添加绑定扩展?
【发布时间】:2018-06-30 14:52:28
【问题描述】:

我只是想添加 bindingExtensions ,我不知道添加 bindingExtensions 时应该在 type 属性中写什么。这是我的配置:

<system.serviceModel>
<extensions>
  <bindingExtensions>
    <add name="MaxClockSkewBinding" type="Microsoft.ServiceModel.Samples.MaxClockSkewBinding, MaxClockSkewBinding,  
            Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
  </bindingExtensions>
</extensions>
<bindings>
  <customBinding>
    <binding name="MaxClockSkewBinding">
      <transactionFlow />
      <security authenticationMode="SecureConversation">
        <secureConversationBootstrap authenticationMode="UserNameOverTransport">
          <localClientSettings maxClockSkew="00:30:00" />
        </secureConversationBootstrap>
        <localClientSettings maxClockSkew="00:30:00" />
      </security>
      <httpsTransport />
    </binding>
  </customBinding>

当我运行我的程序时,错误是:

找不到配置绑定扩展“system.serviceModel/bindings/MaxClockSkewBinding”。验证此绑定扩展是否已在 system.serviceModel/extensions/bindingExtensions 中正确注册,并且拼写正确

这就是我使用我的服务的方式:

channelFactory = new ChannelFactory<TProxy>("*");
            channelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;                
            //channelFactory.Credentials.ServiceCertificate.Authentication.RevocationMode = X509RevocationMode.NoCheck;
            //channelFactory.Credentials.ClientCertificate.Certificate = new X509Certificate2(Certificate, CertificatePass);
            channelFactory.Credentials.UserName.UserName = UserName;
            channelFactory.Credentials.UserName.Password = PassWord;
            var proxy = (IClientChannel)channelFactory.CreateChannel();

【问题讨论】:

    标签: web-services wcf custom-binding


    【解决方案1】:

    在 Visual Studio 中打开Tools &gt; WCF Service Configuration Editor 它可以帮助您创建新的 WCF 服务配置和编辑现有的配置。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-18
      • 2017-06-29
      相关资源
      最近更新 更多