C# 托管在IIS express上的WCF已启用ssl

C# 托管在IIS express上的WCF已启用ssl,c#,wcf,ssl,https,wcf-binding,C#,Wcf,Ssl,Https,Wcf Binding,我已经绞尽脑汁一个星期了,我正在尝试在IIS express上运行WCF服务,并从浏览器中执行GET,HTTP中的一切都很好,但我尝试HTTPS的那一刻它就失败了 http404。您正在查找的资源(或其依赖项之一)可能已被删除、名称已更改或暂时不可用。请查看以下URL并确保其拼写正确。 我试过stackoverflow中的每个配置文件,我也试过,我知道它是用于IIS的,但我不明白为什么它不能在IIS express上工作。这里是我的配置文件: <?xml version="1.0"?>

我已经绞尽脑汁一个星期了,我正在尝试在IIS express上运行WCF服务,并从浏览器中执行
GET
,HTTP中的一切都很好,但我尝试HTTPS的那一刻它就失败了

http404。您正在查找的资源(或其依赖项之一)可能已被删除、名称已更改或暂时不可用。请查看以下URL并确保其拼写正确。

我试过stackoverflow中的每个配置文件,我也试过,我知道它是用于IIS的,但我不明白为什么它不能在IIS express上工作。这里是我的配置文件:

<?xml version="1.0"?>
<configuration>


  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>


  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <behaviors>
      <endpointBehaviors>

        <behavior name="webHttpEnablingBehaviour">

          <webHttp />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>

        <behavior name="webHttpEnablingBehaviour">
          <serviceMetadata httpGetEnabled="true" />
        </behavior>

      </serviceBehaviors>
    </behaviors>
    <services>
      <service
        name="ElasticSearchAPI.GetElasticService" behaviorConfiguration="webHttpEnablingBehaviour">
        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />

        <endpoint address=""
          binding="webHttpBinding"
          bindingConfiguration="default"
          contract="ElasticSearchAPI.IGetElasticService"
          behaviorConfiguration="webHttpEnablingBehaviour">
        </endpoint>
        <endpoint address="other"
          binding="basicHttpBinding"
          bindingConfiguration="default"
          contract="ElasticSearchAPI.IGetElasticService">
        </endpoint>
      </service>

    </services>
    <client />
    <bindings>
      <webHttpBinding>
        <binding name="default" ></binding>
      </webHttpBinding>
      <basicHttpBinding>
        <binding name="default" allowCookies="true"></binding>
      </basicHttpBinding>
    </bindings>
  </system.serviceModel>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <validation validateIntegratedModeConfiguration="false"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>

    <httpProtocol>
      <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
      </customHeaders>
    </httpProtocol>

  </system.webServer>

</configuration>

我肯定我错过了一些非常愚蠢的事情,但是我真的没有主意了,非常感谢你的帮助

更新


我可以使用https访问我的.svc,但当我尝试从浏览器获取或从fiddler发布时,什么都不起作用-

<serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
</behavior>


这可能会对您有所帮助。

在WCF服务配置文件中添加以下内容:

<binding name="secureHttpBinding">
 <security mode="Transport">
  <transport clientCredentialType="None" />
 </security>
</binding>
<httpProtocol>
 <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
 </customHeaders>
</httpProtocol>

在客户端应用程序配置文件中添加以下内容:

<binding name="secureHttpBinding">
 <security mode="Transport">
  <transport clientCredentialType="None" />
 </security>
</binding>
<httpProtocol>
 <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
 </customHeaders>
</httpProtocol>


这将允许您使用HTTPS协议托管和访问WCF服务。

如果有人登录此页面搜索答案,如果您的问题是webconfig,这将解决您的问题。谢谢,但问题已经解决,正如我在评论中提到的。仅供参考,使用了
访问控制允许来源
,因此您可以越过CORS,而不是https协议,它是用于跨域的。感谢您提供的信息。若服务托管在HTTPS上,并且客户端正在从HTTP请求(您正在从HTTP请求),特别是在SOA中针对多个客户端,那个么您需要使用Access Control Allow Origin。这就是我提到添加客户端配置文件以防止进一步错误的原因。