我已经尝试过谷歌以及其他关于 SO 的帖子,到目前为止我所尝试的都没有解决我的问题。
我以为这就是答案。没有骰子。我还阅读了 SO 上的大多数帖子,其中提到了我收到的相同错误消息,例如this。
我的网站是安全的,https。我有 3 个 WCF 服务来处理我在此站点上运行的异步 ajax 内容。当我尝试访问任何这些服务时,我收到此错误:
找不到与绑定 WebHttpBinding 的终结点的方案 http 匹配的基地址。注册的基地址方案是 [https]。
我的配置:
<behaviors>
<endpointBehaviors>
<behavior name="ajaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ajaxAsynchBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webBinding">
<security mode="Transport" />
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="MyApp.Web.Services.CascadingList">
<endpoint address="" behaviorConfiguration="ajaxAsynchBehavior"
binding="webHttpBinding" bindingConfiguration="webBinding" contract="MyApp.Web.Services.CascadingList" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="https://[domain]/MyApp/Services/CascadingList.svc" />
</baseAddresses>
</host>
</service>
<service name="MyApp.Web.Services.AutoComplete">
<endpoint address="" behaviorConfiguration="ajaxAsynchBehavior"
binding="webHttpBinding" bindingConfiguration="webBinding" contract="MyApp.Web.Services.AutoComplete" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="https://[domain]/MyApp/Services/AutoComplete.svc" />
</baseAddresses>
</host>
</service>
<service name="MyApp.Web.Services.Validation">
<endpoint address="" behaviorConfiguration="ajaxAsynchBehavior"
binding="webHttpBinding" bindingConfiguration="webBinding" contract="MyApp.Web.Services.Validation" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="https://[domain]/MyApp/Services/Validation.svc" />
</baseAddresses>
</host>
</service>
</services>
我应该可以访问“ https://[domain]/MyApp/SubmitNew.aspx ”并且级联列表应该可以工作。
目前,“父”列表显示“[方法 500]”,子列表保持禁用状态。
当我点击“SubmitNew”页面时,我的服务器的事件日志显示“发件人信息:System.ServiceModel.Activation.HostedHttpRequestAsyncResult/51442863 异常:System.ServiceModel.ServiceActivationException:无法激活服务'/MyApp/Services/CascadingList.svc'由于编译期间出现异常。异常消息是:找不到与绑定 WebHttpBinding 的端点的方案 http 匹配的基地址。注册的基地址方案是 [https]。 "
如果我直接导航到“ https://[domain]/MyApp/Services/CascadingList.svc ”,我也会收到上述错误。
更新
这发生在我们的生产服务器上。在我加入公司之前很久就建立了带有 SSL 证书的安全站点。我刚刚在安全站点下为我的新 Web 应用程序添加了一个新的虚拟目录。
在 IIS 中:
Secure Web Applications (has SSL cert)
MyApp
WebApp1
WebApp2
我修复了我的配置(上图)以使用正确的行为配置。
-- 2012.04.24 13:15 CDT --
当我将配置更改为此(如下)时,我收到此错误:“ System.ServiceModel.ServiceActivationException:由于编译期间出现异常,无法激活服务'/MyApp/Services/CascadingList.svc'。异常消息是:有没有名为 'ajaxAsynchBehavior' 的端点行为"
<serviceBehaviors>
<behavior name="ajaxAsynchBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<services>
<service name="MyApp.Web.Services.CascadingList">
<endpoint address="" behaviorConfiguration="ajaxAsynchBehavior"
binding="basicHttpBinding" bindingConfiguration="ajaxBinding" contract="MyApp.Web.Services.CascadingList" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="https://[domain]/MyApp/Services/CascadingList.svc" />
</baseAddresses>
</host>
</service>
.
.
.
</services>
所以我把它改回:
<behaviors>
<endpointBehaviors>
<behavior name="ajaxBehavior">
<enableWebScript />
</behavior>
<behavior name="clientBehavior" />
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ajaxAsynchBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="MyApp.Web.Services.CascadingList">
<endpoint address="" behaviorConfiguration="ajaxBehavior"
binding="basicHttpBinding" bindingConfiguration="ajaxBinding" contract="MyApp.Web.Services.CascadingList" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="https://[domain]/MyApp/Services/CascadingList.svc" />
</baseAddresses>
</host>
</service>
.
.
.
</services>