简体   繁体   English

如何将TLS添加到WCF服务?

[英]How do I add TLS to a WCF service?

I've been trying to add TLS to a WCF service, I've created. 我一直在尝试将TLS添加到WCF服务中。 Everything is OK until I try to access the service through https instead of http. 一切正常,直到我尝试通过https而不是http访问该服务。 When adding the wcf service to the wcf test client, I get this: 将wcf服务添加到wcf测试客户端时,我得到以下信息:

Error: Cannot obtain Metadata from [THELINK] If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. 错误:无法从[THELINK]获取元数据如果这是您有权访问的Windows(R)Communication Foundation服务,请检查是否已在指定的地址启用了元数据发布。 For help enabling metadata publishing, please refer to the MSDN documentation at [an MS link] Exchange Error URI: [THELINK] 有关启用元数据发布的帮助,请参阅[MS链接] Exchange错误URI:[THELINK]上的MSDN文档。
Metadata contains a reference that cannot be resolved: '[THELINK]'. 元数据包含无法解析的参考:“ [THELINK]”。
There was no endpoint listening at [THELINK] that could accept the message. 没有端点可以在[THELINK]上侦听该消息。 This is often caused by an incorrect address or SOAP action. 这通常是由不正确的地址或SOAP操作引起的。 See InnerException, if present, for more details. 有关更多详细信息,请参见InnerException(如果存在)。 The remote server returned an error: (403) Forbidden.HTTP GET Error URI: [THELINK] 远程服务器返回错误:(403)禁止。HTTPGET错误URI:[THELINK]
There was an error downloading '[THELINK]'. 下载“ [THELINK]”时出错。 The request failed with HTTP status 403: Forbidden. 请求失败,HTTP状态为403:禁止。

Sorry about the link replacing, but I'm new and I don't have the reputation, it seems :) 抱歉,该链接已替换,但我是新手,没有声誉,看来:)

Regards, Morten 问候,莫滕

do you have a 你有没有

<behaviors> <serviceBehaviors> <behavior name="YourSerivceBehaviourName"> <serviceMetadata httpsGetEnabled="true" /> <-- this bit ? ... ... <behaviors> <serviceBehaviors> <behavior name="YourSerivceBehaviourName"> <serviceMetadata httpsGetEnabled="true" /> <-- this bit ? ... ... being referenced by your <behaviors> <serviceBehaviors> <behavior name="YourSerivceBehaviourName"> <serviceMetadata httpsGetEnabled="true" /> <-- this bit ? ... ...被您的引用

<service name="...." behaviorConfiguration="YourSerivceBehaviourName">

or a 或一个

<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />

in your web.config? 在您的web.config中?

the Test client will also moan if the certificate isn't a real one I have found.. ie a self certed one for testing. 如果证书不是我发现的真实证书,则测试客户端也会抱怨。.即,用于测试的自我认证证书。 but the 403 seems to suggest that whatever credentials you are supplying are incorrect, what is the clientCredentialType set to in the SSL binding? 但是403似乎暗示您提供的任何凭证都不正确,SSL绑定中的clientCredentialType设置为什么?

and what happens if you hit the link in a browser with customerrors off.. this might give you some more useful information 如果您在关闭了customerror的情况下点击浏览器中的链接,会发生什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM