我有几天试图解决我的WCF问题,当Bindings是HTTP时它可以正常工作。但是,一旦我购买了SSL证书并且我将我的网站配置为使用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>
<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 :(得分: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>
答案 1 :(得分:0)
你好 Chris F Carroll ,
感谢您抽出宝贵时间回答我的帖子。
最后,我可以自己修复它。
以下是我在HTTPS和HTTP方面的工作:
< serviceHostingEnvironment multipleSiteBindingEnabled="true" aspNetCompatibilityEnabled="false" />
上面的代码在:
之内
<system.serviceModel>
<system.serviceModel>