在我的 WCF 服务上配置 HTTPS 时出现问题

Problem with configuring HTTPS on my WCF service

我正在尝试将传输安全层添加到我的 WCF 服务。但是在按照所有说明进行操作后,我仍然收到错误 "Could not find a base address that matches scheme https for the endpoint with binding BasicHttpBinding. Registered base address schemes are [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>

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

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

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