WCF服务无法在HTTPS / SSL下运行

时间:2012-02-23 00:14:22

标签: wcf silverlight iis ssl https

我有一个我在Silverlight项目中使用的WCF服务。我几乎都关注了如何为WCF服务设置https和ssl的任何信息。如果不需要SSL,可以完全调用该服务,但我在检查与fiddler的通信时发现WCF服务仍在http协议中。此外,如果我启用SSL,则无法在浏览器中浏览WCF服务(右键单击VS2010 - >选择浏览)。

我怀疑使用http协议的某些内部方法仍在调用该服务。

有关如何解决此问题的任何建议?

<?xml version="1.0" encoding="utf-8"?>

<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
  </system.web>

  <system.serviceModel>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
      multipleSiteBindingsEnabled="true" />

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

      <bindings>

        <customBinding>
          <binding name="AuthService.customBinding" >
            <binaryMessageEncoding />
            <httpsTransport />
          </binding>
        </customBinding>
      </bindings>
      <services>
          <service name="AuthService">
              <endpoint address="" binding="customBinding" bindingConfiguration="AuthService.customBinding" contract="AuthService" />
              <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
          </service>

      </services>

  </system.serviceModel>

</configuration>

由于

1 个答案:

答案 0 :(得分:0)

您使用自定义绑定的原因有任何特定原因。您的服务名称属性和合同属性也需要完全限定。

如果您希望WCF服务与基本配置文件1.1兼容,那么您可以使用简单的basicHttpBinding,它允许非.NET客户端也可以访问。