Ajax 找不到与绑定WebHttpBinding的终结点的方案http匹配的基址。注册的基址方案是[https]
我试过谷歌和其他的帖子,到目前为止,我没有试过解决我的问题 我以为这就是答案。没有骰子。 我还通读了这里的大部分帖子,上面提到了我收到的错误消息,比如 我的网站是安全的,https。我有3个WCF服务来处理这个站点上运行的异步ajax。当我尝试访问这些服务时,我收到以下错误: 找不到与绑定WebHttpBinding的终结点的方案http匹配的基址。注册的基址方案是[https] 我的配置:Ajax 找不到与绑定WebHttpBinding的终结点的方案http匹配的基址。注册的基址方案是[https],ajax,wcf,https,Ajax,Wcf,Https,我试过谷歌和其他的帖子,到目前为止,我没有试过解决我的问题 我以为这就是答案。没有骰子。 我还通读了这里的大部分帖子,上面提到了我收到的错误消息,比如 我的网站是安全的,https。我有3个WCF服务来处理这个站点上运行的异步ajax。当我尝试访问这些服务时,我收到以下错误: 找不到与绑定WebHttpBinding的终结点的方案http匹配的基址。注册的基址方案是[https] 我的配置: <behaviors> <endpointBehaviors>
<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>
我修复了上面的配置以使用正确的行为配置
-2012.04.24 13:15 CDT-
当我将配置更改为下面的配置时,我收到以下错误:System.ServiceModel.ServiceActivationException:由于编译期间出现异常,无法激活服务“/MyApp/Services/CascadingList.svc”。异常消息是:没有名为“ajaxAsynchBehavior”的端点行为
所以我把它改回:
<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>
您的配置看起来很好,但服务行为除外,因为您没有在标记中添加具有正确名称的Behavior配置,因此不会附加这些服务行为。但这并不是你的错误
您是否碰巧使用了VisualStudio内置的web服务器Cassini?因为它看起来像你做的,请记住它不支持HTTPS。这可能就是您出现错误的原因。尝试将您的站点部署到本地IIS服务器,然后检查它是否正常工作。您可以看到如何在IIS 7上设置https开发网站。还有一件事,一旦您将站点部署到IIS,请记住baseAddress标记将被忽略,但您的服务将可以通过其原始名称(即CascadingList.svc)访问,除非配置不同。我将感谢dmusial的回答,包括所有注释,但我想发布我最后的配置更改,以防这对其他人有利 这篇文章也帮助我找到了一个解决方案
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="webScriptEnablingBehavior">
<enableWebScript />
</behavior>
<behavior name="clientBehavior" />
</endpointBehaviors>
<serviceBehaviors>
<behavior name="webScriptEnablingBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webBinding">
<security mode="Transport" />
</binding>
</webHttpBinding>
<wsHttpBinding>
<binding name="customBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="1048576" maxReceivedMessageSize="1048576"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="true" />
<security mode="None">
<transport clientCredentialType="None" />
<message clientCredentialType="None" negotiateServiceCredential="false" establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="MyApp.Web.Services.CascadingList" behaviorConfiguration="webScriptEnablingBehavior">
<endpoint address="" behaviorConfiguration="webScriptEnablingBehavior"
binding="webHttpBinding" bindingConfiguration="webBinding" contract="MyApp.Web.Services.CascadingList" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
<service name="MyApp.Web.Services.AutoComplete" behaviorConfiguration="webScriptEnablingBehavior">
<endpoint address="" behaviorConfiguration="webScriptEnablingBehavior"
binding="webHttpBinding" bindingConfiguration="webBinding" contract="MyApp.Web.Services.AutoComplete" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
<service name="MyApp.Web.Services.Validation" behaviorConfiguration="webScriptEnablingBehavior">
<endpoint address="" behaviorConfiguration="webScriptEnablingBehavior" binding="webHttpBinding" bindingConfiguration="webBinding" contract="MyApp.Web.Services.Validation" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
我通过以下配置解决了我的问题:
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="webBinding">
<security mode="Transport">
</security>
</binding>
</webHttpBinding>
</bindings>
<protocolMapping>
<add binding="webHttpBinding" bindingConfiguration="webBinding" scheme="https" />
</protocolMapping>
</system.serviceModel>
谢谢,我没有注意到我忘记了行为配置。这在生产服务器上发生。您是否在IIS上为您的站点指定了https绑定?是的,站点应全部设置;目前在我们的安全网站上运行的其他web应用程序的运行时间比我在这里工作的时间要长。我只是在这个web应用的安全站点下添加了一个新的虚拟目录。这就是我应该做的,对吗?您是否尝试在本地IIS上使用相同的配置运行服务?另外,请尝试在生产环境中使用basicHttpBinding而不是启用SSL的webHttpBinding公开您的服务,并检查输入url时是否出现相同的行为?我在本地进行了测试,但没有证书。我将尝试使用basicHttpBinding公开服务。将答复结果。。。
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="webScriptEnablingBehavior">
<enableWebScript />
</behavior>
<behavior name="clientBehavior" />
</endpointBehaviors>
<serviceBehaviors>
<behavior name="webScriptEnablingBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webBinding">
<security mode="Transport" />
</binding>
</webHttpBinding>
<wsHttpBinding>
<binding name="customBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="1048576" maxReceivedMessageSize="1048576"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="true" />
<security mode="None">
<transport clientCredentialType="None" />
<message clientCredentialType="None" negotiateServiceCredential="false" establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="MyApp.Web.Services.CascadingList" behaviorConfiguration="webScriptEnablingBehavior">
<endpoint address="" behaviorConfiguration="webScriptEnablingBehavior"
binding="webHttpBinding" bindingConfiguration="webBinding" contract="MyApp.Web.Services.CascadingList" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
<service name="MyApp.Web.Services.AutoComplete" behaviorConfiguration="webScriptEnablingBehavior">
<endpoint address="" behaviorConfiguration="webScriptEnablingBehavior"
binding="webHttpBinding" bindingConfiguration="webBinding" contract="MyApp.Web.Services.AutoComplete" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
<service name="MyApp.Web.Services.Validation" behaviorConfiguration="webScriptEnablingBehavior">
<endpoint address="" behaviorConfiguration="webScriptEnablingBehavior" binding="webHttpBinding" bindingConfiguration="webBinding" contract="MyApp.Web.Services.Validation" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="webBinding">
<security mode="Transport">
</security>
</binding>
</webHttpBinding>
</bindings>
<protocolMapping>
<add binding="webHttpBinding" bindingConfiguration="webBinding" scheme="https" />
</protocolMapping>
</system.serviceModel>