WCF BaseAddress问题和EndPoint问题不起作用

时间:2014-02-22 07:43:12

标签: asp.net wcf wcf-binding

<?xml version="1.0"?>

<configuration>
  <system.web>
    <compilation debug="false" targetFramework="4.0"></compilation>
  </system.web>
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <behaviors>
      <endpointBehaviors>
        <behavior name="">
          <webHttp helpEnabled="true" faultExceptionEnabled="true" />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceAuthorization serviceAuthorizationManagerType="WcfRestService.Infrastructure.BasicAuthenticationManager, WcfRestService" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceMetadata httpsGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <webHttpBinding>
        <binding name="">
          <security mode="Transport" />
        </binding>
      </webHttpBinding>
    </bindings>
  </system.serviceModel>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <add name="UrlRoutingModule"
           type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

    </modules>
    <handlers>
      <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd"
           type="System.Web.HttpForbiddenHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </handlers>
  </system.webServer>
</configuration>
  

无法找到与方案https匹配的基地址   绑定WebHttpBinding的端点。注册的基地址方案。   我从visual studio运行它如何在本地运行它。   是[http]。

1 个答案:

答案 0 :(得分:2)

您可以尝试在配置文件中明确地将webHttpBinding映射到https协议,如下所示:

<protocolMapping>
  <add scheme="https" binding="webHttpBinding" />
</protocolMapping>

这可以在<system.serviceModel>部分找到。这将告诉服务默认使用webHttpBinding https个请求(IIRC,basicHttpsBindinghttps的WCF默认值。