hossein bagheri
hossein bagheri

Reputation: 1

how to add bindingExtensions in webconfig?

i just wanna add bindingExtensions , i dont know what should i write in type attribute when add bindingExtensions. this is my config :

<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>

when i run my program , error is :

Configuration binding extension 'system.serviceModel/bindings/MaxClockSkewBinding' could not be found. Verify that this binding extension is properly registered in system.serviceModel/extensions/bindingExtensions and that it is spelled correctly

and this is how i use my service :

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();

Upvotes: 0

Views: 782

Answers (1)

astef
astef

Reputation: 9478

In Visual Studio open Tools > WCF Service Configuration Editor: enter image description here It can help you a lot with creating new WCF service configs and editing an existing one.

Upvotes: 0

Related Questions