【问题标题】:WCF Rest Service - worked great ... Until SSLWCF 休息服务 - 工作得很好......直到 SSL
【发布时间】:2014-03-20 15:03:40
【问题描述】:

我有一个运行非常顺利的 WCF Rest 服务。我刚刚获得了我的 SSL 证书并将其安装在 IIS 中,添加了一个自动重定向到 https(基本上是强制 https)。现在,如果我转到“website/ServiceDirectory/Service.svc”,我仍然会收到“您已创建服务”消息,但是当我尝试实际调用该服务时,我得到 404 未找到。我已经看过通过大量文章。我禁用了 http/启用的 https。我确保我在绑定中启用了“传输”安全性..不确定我是否只是遗漏了什么或发生了什么。这是我的网络配置,但我我开始认为这可能是 IIS 中的某些东西

  <system.serviceModel>
<client>
  <endpoint address=""
            binding="webHttpBinding" bindingConfiguration="WebBinding"
            behaviorConfiguration="web"
            contract="EngageService.IEngage" name="win"/>
</client>
<bindings>
  <webHttpBinding>
    <binding name="WebBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </webHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<services>
  <service behaviorConfiguration="ServiceBehavior" name="EngageService.Engage1">
    <endpoint address="" behaviorConfiguration="web" binding="webHttpBinding"
      contract="EngageService.IEngage" bindingConfiguration="WebBinding" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior">
      <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="web">
      <webHttp defaultOutgoingResponseFormat="Xml"/>
    </behavior>
  </endpointBehaviors>
</behaviors>
<protocolMapping>
  <!--<add binding="basicHttpBinding" scheme="http"/>-->
  <add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>

在 IIS 中,该服务被配置为一个应用程序,正如我所说,在我切换到 https 之前它运行良好。是否有人看到我的配置文件有问题,或者知道我可能需要检查/更改的任何 IIS 配置项? 谢谢

【问题讨论】:

  • 在 IIS7 => features view => SSL Settings,如果在 web.config 中添加要求,可以关闭 Require SSL 选项
  • 不知道我解释的是否正确。如果有人能目睹这种行为可能会更好。如果你去aaronsfriedman.com/Engage/Engage1.svc,你会看到服务信息。如果你去aaronsfriedman.com/Engage/Engage1.svc/getquote,你会得到一个愚蠢的随机报价(用于测试)。如果您随后使用 https 执行相同的步骤,您仍会看到该服务,但在尝试运行该功能时会收到“未找到”错误。

标签: wcf rest iis ssl


【解决方案1】:

好的,这归结为协议映射部分。好像没有这个映射,webhttpbinding默认是http。添加了 webhttpbinding,包括整个部分以使其更容易被发现 - 希望有一天这对其他人有所帮助。

<protocolMapping>
  <!--<add binding="basicHttpBinding" scheme="http"/>-->
  <add binding="basicHttpsBinding" scheme="https"/>
  <add binding="webHttpBinding" scheme="https" bindingConfiguration="WebBinding"/>
</protocolMapping>

如果您已经尝试了所有其他文章,但仍然无法获得它 - 请尝试上述方法。它破坏了http,但我想只是因为你在窃取端点。如果您配置了辅助 http 绑定,我敢打赌它会完美运行。

【讨论】:

    猜你喜欢
    • 2014-04-25
    • 1970-01-01
    • 1970-01-01
    • 2011-08-10
    • 2012-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-08
    相关资源
    最近更新 更多