我想要做的是让一个单一的WCF服务在HTTP方案的开发环境中工作,并且在生产环境中使用SAME服务也是HTTPS方案.如果我删除两个Https端点(后缀为'Https'),它可以在开发环境中工作; 同样,如果我只删除两个Http端点,那么它在生产环境中工作.如果可能的话,我想在web.config中拥有所有四个端点.
我的终点定义如下:
<endpoint address="/Web"
behaviorConfiguration="AjaxBehavior"
binding="wsHttpBinding"
bindingConfiguration="web"
name="Web"
contract="Service" />
<endpoint address="/Custom"
binding="customBinding"
bindingConfiguration="custom"
name="Custom"
contract="Service" />
<endpoint
address="/WebHttps"
behaviorConfiguration="AjaxBehavior"
binding="wsHttpBinding"
bindingConfiguration="webHttps"
name="WebHttps"
contract="Service" />
<endpoint address="/CustomHttps"
binding="customBinding"
bindingConfiguration="customHttps"
name="CustomHttps"
contract="Service" />
Run Code Online (Sandbox Code Playgroud)
编辑:我正在编辑我的问题,以添加我得到的错误,以及绑定部分(下面).对不起这个问题的新篇幅.
错误是:"无法找到与绑定WebHttpBinding的端点的方案http匹配的基址.已注册的基址方案为[https]."
此外,生产站点设置为"需要SSL".那无法改变.
绑定配置是:
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="AjaxBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="custom">
<textMessageEncoding>
<readerQuotas maxDepth="7000000" maxStringContentLength="7000000"
maxArrayLength="7000000" maxBytesPerRead="7000000"
maxNameTableCharCount="7000000" />
</textMessageEncoding>
<httpTransport maxBufferPoolSize="7000000" maxReceivedMessageSize="7000000"
maxBufferSize="7000000" />
</binding>
<binding name="customHttps">
<textMessageEncoding> …Run Code Online (Sandbox Code Playgroud)