Asp.net Ajax可以在HTTPS中调用WCF服务吗

Asp.net Ajax可以在HTTPS中调用WCF服务吗,asp.net,ajax,wcf,web,http-status-code-404,Asp.net,Ajax,Wcf,Web,Http Status Code 404,我在web应用程序中托管了一个wcf服务,当我们尝试使用http访问该服务时,它工作得很好,但是当我们在https下访问它时,它给出404未找到,我如何在https下启用wcf服务以允许ajax get调用?如果这就是问题所在 以下是配置: <webHttpBinding> <binding name="secure" maxBufferSize="655360" maxBufferPoolSize="5242880" maxReceivedMessageSize=

我在web应用程序中托管了一个wcf服务,当我们尝试使用http访问该服务时,它工作得很好,但是当我们在https下访问它时,它给出404未找到,我如何在https下启用wcf服务以允许ajax get调用?如果这就是问题所在

以下是配置:

  <webHttpBinding>
    <binding name="secure" maxBufferSize="655360" maxBufferPoolSize="5242880" maxReceivedMessageSize="655360">
      <readerQuotas maxDepth="32" maxStringContentLength="655360" maxArrayLength="655360" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
      <security mode="None"/>
    </binding>
  </webHttpBinding>
</bindings>
<services>
  <service name="CampWareMobileServices.HousekeepingMobileService" behaviorConfiguration="ServiceBehavior">
    <clear/>
    <endpoint address="" binding="webHttpBinding" behaviorConfiguration="webBehavior" contract="CampWareMobileServices.IHousekeepingMobileService" />

  </service>
</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="webBehavior">
      <webHttp/>
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior">
      <serviceMetadata httpGetEnabled="True" httpsGetEnabled="true"/>

      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

您需要有两个不同的端点和绑定,如下所示。我在这里已经回答了类似的问题-


这里缺少太多的信息,无法提供帮助。您正在使用IIS吗?您是否在IIS服务器上设置了HTTPS绑定?您好,thnx用于快速响应,是的,它是在IIS中设置的,HTTPS绑定是设置的
<system.serviceModel>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  <bindings>
    <webHttpBinding>
      <binding name="Binding" crossDomainScriptAccessEnabled="true">
        <security mode="Transport">
          <transport clientCredentialType="None" />
        </security>
      </binding>
      <binding name="httpbind" crossDomainScriptAccessEnabled="true">
      </binding>
    </webHttpBinding>
  </bindings>
  <client />
  <services>
    <service name="RestService.service"  behaviorConfiguration="ServiceBehaviour">
      <endpoint address="" binding="webHttpBinding" bindingConfiguration="Binding" contract="RestService.Iservice" behaviorConfiguration="web">
      </endpoint>
      <endpoint address="" binding="webHttpBinding" bindingConfiguration="httpbind" contract="RestService.Iservice" behaviorConfiguration="web">
      </endpoint>
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior name="ServiceBehaviour">
        <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
      <behavior name="web">
        <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
    </serviceBehaviors>
    <endpointBehaviors>
      <behavior name="web">
        <webHttp helpEnabled="true" />
      </behavior>
    </endpointBehaviors>
  </behaviors>
</system.serviceModel>