【问题标题】:Problem with configuring HTTPS on my WCF service在我的 WCF 服务上配置 HTTPS 的问题
【发布时间】:2020-01-09 10:47:39
【问题描述】:

我正在尝试将传输安全层添加到我的 WCF 服务。但是按照所有说明操作后,我仍然收到错误“找不到与绑定 BasicHttpBinding 的端点的方案 https 匹配的基地址。注册的基地址方案是 [http]。”

已经在 IIS 管理器中完成了所有需要的配置,并在 web.config 中添加了需要的代码,但我仍然觉得我缺少一些东西

web.config:

   <system.serviceModel>   
          <services>
              <service name="MyNameSpace.MyService" behaviorConfiguration="secureBehavior">                     
                <endpoint address="" binding="basicHttpBinding" bindingConfiguration="secureHttpBinding" contract="MyNameSpace.IMyService" />
                <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
              </service>          
            </services>

        <bindings>
          <basicHttpBinding>
            <binding name="secureHttpBinding">
              <security mode="Transport">
                <transport clientCredentialType="None" />
              </security>
            </binding>
          </basicHttpBinding>      
        </bindings>

        <behaviors>
          <serviceBehaviors>
            <behavior name="secureBehavior">
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>    

        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      </system.serviceModel>

【问题讨论】:

  • 您是否在服务器上启用了 SSL?

标签: c# wcf iis https


【解决方案1】:

您当前的配置没有问题,配置一个 https 端点,它使用传输安全模式。我们需要做的另一件事是在 IIS 绑定模块中配置一个 https 绑定地址。如下所示。

它位于IIS站点绑定模块中。

然后我们可以使用上面的https服务地址来访问它。
https://IP:4431/Service1.svc(服务基地址)
如果问题仍然存在,请随时告诉我。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-04
    • 1970-01-01
    • 2013-10-14
    • 2011-03-28
    • 2011-10-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多