簡體   English   中英

wcf找不到與綁定BasicHttpsBinding的端點的方案https匹配的基地址。

[英]wcf Could not find a base address that matches scheme https for the endpoint with binding BasicHttpsBinding.

我用自定義身份驗證創建了一個簡單的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項目的SSL。

您在服務配置中缺少基地址:

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

  ...

  <host>
    <baseAddresses>
       <add baseAddress="https://localhost/myserviceaddress/" />
    </baseAddresses>
   </host>
</service>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM