【发布时间】:2014-03-29 15:36:22
【问题描述】:
我有一个带有以下配置文件的 WCF 服务。即使我指定了clientCredentialType = None,WCF 服务(来自 VS2013)也会抛出异常,说明未指定证书。
为什么会这样?仅当 clientCredentialType 设置为证书时才需要证书。
<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>
【问题讨论】:
-
什么时候得到异常,ServiceHost.Open()?您能否提供有关异常的更多详细信息。
-
我同意 Petar 的观点。是客户端进程还是服务器异常?它是自托管服务器,还是托管在 IIS 之类的东西上?
-
这是您的绑定规范。见this link。
-
尝试只使用basicHttpBinding。此外,如果这是您的意图,您的端点实际上并没有使用上面定义的 bindingConfiguration。请参阅此处了解如何执行我认为您正在尝试的简单示例:stackoverflow.com/questions/7043814/…
-
将
设置为无。
标签: c# .net web-services wcf