2012-06-27 67 views
0

我有一個WCF服務需要使用SSL使用basicHttpBinding進行託管。 所以我的團隊已經安裝了SSL證書,並啓用了匿名身份驗證,並在IIS中給出了硬編碼的用戶名和密碼。 我試着給這個綁定WCF中的Https綁定拋出錯誤

<binding name="SecurityByTransport"> 
       <security mode="Transport"> 
       <transport clientCredentialType="Windows" /> 
       </security> 
      </binding> 

但它仍然無法正常工作。我得到這個錯誤「找不到與綁定basicHttpBinding的端點符合計劃http的基址註冊的基址方案是[HTTPS]。」

ServiceModel部分:

<system.serviceModel> 
<diagnostics> 
    <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtTransportLevel="true" /> 
</diagnostics> 
<bindings> 
    <customBinding> 
    <binding name="netTcp"> 
     <binaryMessageEncoding> 
     <readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647" maxDepth="64" /> 
     </binaryMessageEncoding> 
     <security authenticationMode="UserNameOverTransport" /> 
     <windowsStreamSecurity /> 
     <tcpTransport portSharingEnabled="true" maxBufferPoolSize="52428800" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" /> 
    </binding> 
    </customBinding> 

    <basicHttpBinding> 
    <binding name="Https"> 
     <security mode="Transport"> 

     </security> 
    </binding> 
    </basicHttpBinding> 

</bindings> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name ="Https"> 

     <serviceMetadata httpsGetEnabled="true"/> 

     <serviceDebug includeExceptionDetailInFaults="false"/> 
     <serviceCredentials> 
     <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Asi.Soa.ServiceModelEx.NullUserNamePasswordValidator, Asi.Soa.ServiceModelEx" /> 
     <clientCertificate> 
      <authentication certificateValidationMode="None" /> 
     </clientCertificate> 
     </serviceCredentials> 
     <serviceAuthorization principalPermissionMode="Custom"> 
     <authorizationPolicies> 
      <add policyType="Asi.Soa.ServiceModelEx.ClaimsAuthorizationPolicy, Asi.Soa.ServiceModelEx" /> 
     </authorizationPolicies> 
     </serviceAuthorization> 
     <exceptionShielding/> 
    </behavior> 


    </serviceBehaviors> 
    <endpointBehaviors> 
    <behavior name="SoapBehavior"> 

    </behavior> 
    <behavior name="RestBehavior"> 

    </behavior> 
    <behavior name="AjaxBehavior"> 
     <enableWebScript /> 
    </behavior> 
    </endpointBehaviors> 
</behaviors> 
<services> 


    <service name="Asi.Soa.Core.Services.EntityService" > 
    <endpoint address="https://10.42.150.122/imis15/EntityService.svc" binding="basicHttpBinding" contract="Asi.Soa.Core.ServiceContracts.IEntityService" 
     bindingConfiguration="Https" /> 
    </service> 

</services> 

任何幫助,將不勝感激。

感謝

+0

你可以完全發佈serviceModel部分來幫助你嗎? – Rajesh

+0

使用serviceModel部分Rajesh編輯帖子。任何建議都會非常有幫助。 – Deefa

+0

你在IIS上託管你的服務? – Rajesh

回答

1

嘗試添加到服務行爲設置

 <serviceMetadata httpsGetEnabled="true"/> 

您也應該檢查endpoind有一個設置

 bindingConfiguration="SecurityByTransport" 
+0

嗨paramosh,請你能看看serviceModel部分,net.tcp綁定的作品很好,我需要同樣爲basicHttpBinding的工作,使我能夠使用https – Deefa

+0

<服務名稱=「Asi.Soa.Core.Services.EntityService」 behaviorConfiguration =「Https」> – paramosh

+0

通過添加HttpsGetEnabled = true和HttpGetEnabled = false解決了它;謝謝大家。 – Deefa

0

如果你正在主持在IIS服務,請嘗試從網站綁定中刪除http綁定。

HTH

0

由於您使用的是IIS Web服務,使用HTTPS它考慮到你正在使用SSL證書綁定。