我正在尝试做的是让 SINGLE 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" />
已编辑:我正在编辑我的问题以添加我遇到的错误以及绑定部分(如下)。很抱歉问题的新长度。
错误是:“找不到与绑定 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>
<readerQuotas maxDepth="7000000" maxStringContentLength="7000000"
maxArrayLength="7000000" maxBytesPerRead="7000000"
maxNameTableCharCount="7000000" />
</textMessageEncoding>
<httpsTransport maxBufferPoolSize="7000000" maxReceivedMessageSize="7000000"
maxBufferSize="7000000" />
</binding>
</customBinding>
<webHttpBinding>
<binding name="web" maxBufferPoolSize="70000000"
maxReceivedMessageSize="70000000">
<readerQuotas maxDepth="70000000" maxStringContentLength="70000000"
maxArrayLength="70000000" maxBytesPerRead="70000000"
maxNameTableCharCount="70000000" />
<security mode="None" />
</binding>
<binding name="webHttps" maxBufferPoolSize="70000000"
maxReceivedMessageSize="70000000">
<readerQuotas maxDepth="70000000" maxStringContentLength="70000000"
maxArrayLength="70000000" maxBytesPerRead="70000000"
maxNameTableCharCount="70000000" />
<security mode="Transport" />
</binding>
</webHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
有任何想法吗?