2017-01-26 67 views
0

我有两天的时间试图解决WCF的问题,这些问题在绑定是HTTP时可以工作。但是,一旦我购买了SSL证书,并将我的网站配置为使用HTTPS,当我更改IIS上的绑定时,我的应用程序就不可用。我如何使用带有SSL证书的WCF HTTPS IIS

我得到了以下错误消息: Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [https].

我的web.config

<services> 
    <service behaviorConfiguration="WebServiceBehavior" name="WcfService1.Service"> 
    <endpoint address="" behaviorConfiguration="jsonBehavior" binding="webHttpBinding" 
       bindingConfiguration="webHttpBindingWithJsonP" contract="WcfService1.IService"/> 
    <endpoint address="soap" binding="basicHttpBinding" contract="WcfService1.IService" /> 
    </service> 
</services> 

<behaviors> 
    <endpointBehaviors> 
    <behavior name="jsonBehavior"> 
     <webHttp helpEnabled="true"/> 
    </behavior> 
    </endpointBehaviors> 

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

<bindings> 
    <webHttpBinding> 
    <binding name="webHttpBindingWithJsonP" 
      crossDomainScriptAccessEnabled="true" /> 

    </webHttpBinding> 

</bindings> 

它可以让我的WCF使用HTTPS的工作?

回答

0

这是否有帮助https://msdn.microsoft.com/en-us/library/hh556232(v=vs.110).aspx?它包含一个完整的https配置示例。

我特别想你所需要的security mode=Transport的SSL工作:

<binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true"> 
    <security mode="Transport"> 
     <transport clientCredentialType="None"/> 
    </security> 
</binding> 
0

克里斯˚F卡罗尔

感谢您抽出时间来回答我的帖子。

最后,我可以自己修复它。

这里是我做的,以获得关于HTTPS和HTTP工作: < serviceHostingEnvironment multipleSiteBindingEnabled="true" aspNetCompatibilityEnabled="false" />

上面的代码放在里面:

<system.serviceModel>