我只是想添加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();