[英]Why does the WCF service with the following configuration not work?
I have a WCF service with the below config file. 我有一个WCF服务与下面的配置文件。 Even though I have specified clientCredentialType = None
, the WCF service (from VS2013), throws exception stating that certificate is not specified. 即使我已指定clientCredentialType = None
,WCF服务(来自VS2013)也会抛出异常,指出未指定证书。
Why is it so? 为什么会这样? Shouldn't a certificate be required only if the clientCredentialType
is set as Certificate. 仅当clientCredentialType
设置为Certificate时,才需要证书。
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding>
<security mode="Message">
<message clientCredentialType="Windows"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="WCFBindingwshttpBinding.Service1">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="" contract="WCFBindingwshttpBinding.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/WCFBindingwshttpBinding/Service1/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
I think you are getting the error because you have not specified a Server certificate. 我认为您收到错误是因为您没有指定服务器证书。
As I recall, WCF requires transport level security when using message encryption ( <security mode="Message">
) in order to securely exchange the “shared secret” and establish the security context. 我记得,在使用消息加密( <security mode="Message">
)时,WCF需要传输级安全性,以便安全地交换“共享密钥”并建立安全上下文。 Therefore, since you are using the WSHttpBinding
, then the Server certificate is used to establish the security channel. 因此,由于您使用的是WSHttpBinding
,因此使用Server证书来建立安全通道。
The following link provides good related information: 以下链接提供了良好的相关信息:
WCF message security without certificate and windows auth 没有证书和Windows身份验证的WCF消息安全性
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.