wcf找不到与绑定BasicHttpsBinding的端点的方案https匹配的基址。

时间:2017-04-12 11:50:38

标签: c# wcf

我使用自定义身份验证创建一个简单的wcf项目,因为您可以看到我的配置文件:

 <system.serviceModel>

    <services>
      <service name="WcfService1.Service1" behaviorConfiguration="authBehavior">

        <!-- Service Endpoints. A Service may provide multiple endpoints -->
        <!-- Not need to define host. Relative  -->
        <endpoint address="" binding="basicHttpsBinding" contract="WcfService1.IService1" bindingConfiguration="httpsBindingConfig">
          <!-- 
              Upon deployment, the following identity element should be removed or replaced to reflect the 
              identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
              automatically.
          -->
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>


        <!-- Metadata Endpoints -->
        <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
        <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
     <bindings>
      <basicHttpsBinding>
        <binding name="httpsBindingConfig">
          <security mode="TransportWithMessageCredential">
            <message clientCredentialType="UserName" />
            <transport clientCredentialType="None" />
          </security>
        </binding>
      </basicHttpsBinding>
      <basicHttpBinding>
        <binding name="basicHttpBindingConfig">
          <security mode="TransportWithMessageCredential">
            <message clientCredentialType="UserName" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>

          <behavior name="authBehavior">
      <serviceCredentials>
        <userNameAuthentication userNamePasswordValidationMode="Custom"  customUserNamePasswordValidatorType="WcfService1.IdentityValidator,WcfService1" />
      </serviceCredentials>
      <serviceAuthorization principalPermissionMode="Custom" serviceAuthorizationManagerType="WcfService1.RoleAuthorizationManager,WcfService1">

      </serviceAuthorization>

    </behavior>
      </serviceBehaviors>
    </behaviors>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>

当我运行我的服务时,我得到了他的错误:

Could not find a base address that matches scheme https for the endpoint with binding BasicHttpsBinding. Registered base address schemes are [http].

我很高兴wcf对不起我的简单问题。

2 个答案:

答案 0 :(得分:0)

解决方案是启用wcf项目的SSL。

答案 1 :(得分:0)

您缺少服务配置中的基地址:

push()