尝试访问WCF服务时出现以下错误。
找不到与绑定MetadataExchangeHttpBinding的端点的方案http匹配的基地址。注册的基址方案为[https]。
这是我的配置
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true"/>
<customErrors mode="Off"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="DefaultHttpBinding"
maxBufferSize="655360"
maxReceivedMessageSize="655360">
</binding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
<baseAddressPrefixFilters>
<add prefix="http://MySite.com/MyVirtualDir/"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
<services>
<service behaviorConfiguration="DefaultBehavior"
name="MyWcfService">
<endpoint address="http://MySite.com/MyVirtualDir/MyWcfService.svc"
binding="basicHttpBinding"
bindingConfiguration="DefaultHttpBinding"
contract="MyNamespace.IMyWcfService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultBehavior">
<serviceMetadata httpGetEnabled="true"
policyVersion="Policy15"/>
<serviceDebug httpHelpPageEnabled="true"
includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
这是我的.scv文件
<%@ ServiceHost Language="C#" Debug="true" Service="MyWcfService" Factory="MyWcfServiceHostFactory"%>
提供更多可能有用或无效的背景
该服务在我们的DEV环境中运行良好。仅此错误
发生在我们的TEST和PROD环境中。唯一可识别的
我知道的环境之间的差异是TEST和PROD正在使用
负载均衡器。
该服务托管在所有环境中的IIS 5.1中
该服务已在dot.net 3.5中编写,并已由
WebServiceHost工厂
我没有在配置文件中的任何地方指定https
在任何环境中的IIS中都未启用SSL。启用了匿名访问(稍后将实现安全性实施)。
任何帮助将不胜感激,因为这是我们项目的一个完整的展示机会。我已经在网上搜索了有关此问题的解决方案,但似乎与我的设置无关。
最佳答案
尝试对服务启用跟踪,以检查在测试/生产环境中失败的原因。要启用跟踪,请检查此link
您确定MyWcfServiceHostFactory没有任何与配置相关的代码(即通过c#代码构建配置)
关于c# - WCF中的C#绑定(bind)错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8182655/