“The service certificate is not provided. Specify a service certificate in ServiceCredentials.
”是我将浏览器指向svc
文件地址时看到的内容
如下所示,我的serviceCredentials
部分已被注释(这只是某本书中的一个示例),因为我不需要任何证书。但显然我无法避免......我该怎么办?
basicHttpBinding
,因为我需要会话支持我的约束力:
<wsHttpBinding>
<binding name="BindingToViewer" sendTimeout="00:25:00">
<security mode="Message">
<message clientCredentialType = "None"/>
</security>
</binding>
</wsHttpBinding>
我的服务:
<service name="SomeNs.Whatever.ServName" behaviorConfiguration="NoPrinPermMode">
<endpoint address="" binding="wsHttpBinding"
bindingConfiguration="BindingToViewer"
contract="SomeNs.Whatever.IMyInterface">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<host>
<baseAddresses>
<add baseAddress="https://localhost/"/>
</baseAddresses>
</host>
</service>
我的服务行为:
<serviceBehaviors>
<behavior name="NoPrinPermMode">
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
<serviceAuthorization principalPermissionMode="None" />
<!--<serviceCredentials>
<serviceCertificate
findValue = "MyServiceCert"
storeLocation = "LocalMachine"
storeName = "My"
x509FindType = "FindBySubjectName"/>
</serviceCredentials>-->
</behavior>
</serviceBehaviors>
答案 0 :(得分:1)
不要在基地址中使用https:
<add baseAddress="https://localhost/"/>
改为使用:
<add baseAddress="http://localhost/"/>
并删除httpsGetEnabled:
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
为:
<serviceMetadata httpGetEnabled="True" />
并删除身份,因为您不需要验证服务
<identity>
<dns value="localhost" />
</identity>
修改强> 也删除
<security mode="Message">
<message clientCredentialType = "None"/>
</security>
答案 1 :(得分:1)
您已在WSHttpBinding中配置了邮件安全性,这意味着您的服务必须提供证书(除非您使用Windows身份验证)。问题是你需要什么样的安全性呢?