7
這是一個常見問題,我已經查看了所有答案,但沒有任何幫助。HTTP請求被禁止,客戶端身份驗證方案'匿名'
我想讓SSL與iis上託管的basichttpbinding和WCF服務一起工作。我認爲問題出在iis或證書上。我在iis經理中創建了一個自簽名證書。我的證書被稱爲「mycomputer」,並已被置於受信任的根證書之下。客戶沒有問題找到證書。
我在iis中的設置是啓用匿名身份驗證,並禁用其他一切。還需要SSL並接受客戶端證書。那是對的嗎?如果我選擇忽略,則會出現錯誤。
我無法看到我的配置有什麼問題,這些是正確的嗎?
服務配置:
<system.serviceModel>
<services>
<service behaviorConfiguration="MyBehaviour" name="BasicHttpSecTest.Service1">
<endpoint name="MyEndPoint" address="https://mycomputer/wp/" binding="basicHttpBinding" bindingConfiguration="ClientCertificateTransportSecurity" contract="BasicHttpSecTest.IService1" />
<!--<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />-->
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyBehaviour">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<clientCertificate>
<authentication certificateValidationMode="PeerOrChainTrust" revocationMode="NoCheck"/>
</clientCertificate>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="ClientCertificateTransportSecurity">
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
客戶端配置:
<system.serviceModel>
<client>
<endpoint address="https://mycomputer/wp/Service1.svc" binding="basicHttpBinding"
bindingConfiguration="MyEndPoint" contract="ServiceSSLref.IService1"
name="MyEndPoint1" behaviorConfiguration="ClientCertificateCredential"/>
</client>
<bindings>
<basicHttpBinding>
<binding name="MyEndPoint">
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="ClientCertificateCredential">
<clientCredentials>
<clientCertificate findValue="mycomputer" storeLocation="LocalMachine" storeName="My" x509FindType="FindByIssuerName" />
<serviceCertificate>
<authentication certificateValidationMode="PeerOrChainTrust" revocationMode="NoCheck"/>
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
謝謝,我認爲這可能是解決這個錯誤。但是,我收到「遠程服務器返回了意外的響應:(405)方法不允許。」在同一階段,所以即時通訊不知道如果它更好或更差 – Zeezer 2013-02-13 13:27:46
看看你的合同界面是否有公共關鍵字。別忘了C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319> ServiceModelReg.exe -i – Alex 2013-02-13 13:31:49
非常感謝!一直坐在這個問題的日子。現在它的工作和最後一個問題很容易解決。我的地址應該是https://mycomputer/wp/Service1.svc,而不是https:// mycomputer/wp /。 – Zeezer 2013-02-13 13:39:28