簡體   English   中英

如何在webconfig中添加bindingExtensions?

[英]how to add bindingExtensions in webconfig?

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

在Visual Studio中,打開“ Tools > WCF Service Configuration Editor 在此處輸入圖片說明 它可以幫助您創建新的WCF服務配置並編輯現有的配置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM