https - https环境下的WCF服务

标签 https wcf

我已经创建并测试了 WCF 服务,一切正常。

当我部署到 TEST 环境并尝试打开 https://my.site/myapp/EnrollmentService.svc我收到错误消息:

Could not find a base address that matches scheme http for the endpoint with binding MetadataExchangeHttpBinding. Registered base address schemes are [https].



互联网向我展示了我需要添加更多配置选项:

http://www.codeproject.com/KB/WCF/7stepsWCF.aspx

我在服务 web.config 文件中添加了一些设置。现在它看起来像以下方式:
<system.serviceModel>
<services>
  <service name="McActivationApp.EnrollmentService" behaviorConfiguration="McActivationApp.EnrollmentServicBehavior">
    <endpoint 
      address="https://my.site/myapp/EnrollmentService.svc"
      binding="basicHttpBinding"
      bindingConfiguration="TransportSecurity"
      contract="McActivationApp.IEnrollmentService"/>
    <endpoint address="mex" binding="mexHttpBinding" contract="McActivationApp.IEnrollmentService" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="McActivationApp.EnrollmentServicBehavior">
      <serviceMetadata httpGetEnabled="True"/>
      <serviceDebug includeExceptionDetailInFaults="False" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding name="TransportSecurity">
      <security mode="Transport">
        <transport clientCredentialType="None" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>

实际上,我已经添加了“绑定(bind)”部分并为我的端点指定了它。

但这并没有改变...

请指教,我需要做什么。非常感谢!

附言使用 https 和 http 资源的 WCF 服务有什么不同吗?

最佳答案

您已经获得了应该更改为 https 的 http 元数据端点,如下所示。

<serviceMetadata httpsGetEnabled="True"/>  

此外,如果没有必要,您应该从生产中删除 mex 和 https 元数据端点作为最佳实践。

关于https - https环境下的WCF服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4651896/

相关文章:

javascript - 带有 HTTPS 请求的 Node.JS UnhandledException

ruby-on-rails - 如何使用 nginx 配置 phusion passenger 以支持 rails 中的 ssl?

php - HTTPS 返回包含 header 的纯文本

apache - 我可以仅从 SSLCertificateKeyFile.key 和 SSLCertificateFile.crt 文件创建 ssl 证书链吗?

c# - 枚举未在 WCF 中序列化

wcf - SOAP1.1 或 SOAP1.2

visual-c++ - Windows下获取不到私钥时如何解密数据?

.net - 针对不受信任的 SSL 端点生成 WCF 代理

.net - 如何在 WCF 服务和客户端之间共享对象?

c# - Dynamics CRM 2011 实体