WCF 使用 BasicHttpBinding 证书通过 http 和 https 公开服务仍然在浏览器中显示 NotSecure

WCF Exposing service with http and https using BasicHttpBinding Certificate still says NotSecure in browser

我在 BasicHttpBinding 上公开具有两个端点的单个 WCF 服务。但是,一种用于 http,另一种用于安全 (SSL)。我使用以下内容成功实现了这一目标。

在 IIS 中,我还在站点 SSL 中配置了默认开发证书,然后单击 "Require SSL" 并单击 Ignore/Accept 就可以了。

我的问题:

我看到当我在浏览器中使用 https 调用时,我看到 "Not Secure" 警告,您单击以继续,它是红色的,但带有 https。当我单击“不安全”按钮时,我看到证书无效。我需要在浏览器中做些什么吗?或者服务器行为中下面的证书配置应该转到端点行为吗?

 <services>
      <service behaviorConfiguration="myServiceBehavior" name="MyService">

         <endpoint address="" binding="basicHttpBinding" bindingConfiguration="" contract="IInvoiceService"/>
         <endpoint address="" binding="basicHttpBinding" bindingConfiguration="myBinding" contract="IInvoiceService"/>
      </service>
  </services>
    <bindings>
      <basicHttpBinding>
        <binding name="myBinding" >          
          <security mode="Transport">
           <transport clientCredentialType="Certificate"/>
          </security>
        </binding>        
      </basicHttpBinding>
</bindings>


<behaviors>
    <endpointBehaviors>
    <behavior name="graph">
        </behavior>
    </endpointBehaviors>
      <serviceBehaviors>
      <behavior name="myServiceBehavior">
       <serviceCredentials>
      <serviceCertificate findValue="localhost" storeLocation="LocalMachine"
        storeName="My" x509FindType="FindBySubjectName" />
      <userNameAuthentication userNamePasswordValidationMode="Windows" />
    </serviceCredentials>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

将证书添加到本地计算机的受信任的人(客户端访问服务时使用的)存储区。安装到受信人商店后,双击查看是否有其他错误。

<serviceCertificate 使用此元素指定将用于向客户端验证服务的 X.509 证书

using Message security mode

。如果您使用的证书会定期更新,则其指纹会发生变化。在这种情况下,使用主题名称作为 x509FindType,因为可以使用相同的主题名称重新颁发证书。