WCF,从http转移到https

时间:2013-12-12 03:30:52

标签: wcf https web-config

我知道这个主题几次都在stackexchange上,但我找不到我的问题的答案,这个问题与其他问题不同......

我收到错误,Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http]. 这是我的web.config文件,谁能告诉我缺少什么?

 <?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="NewBehavior">
          <!-- To avoid disclosing metadata information, 
          set the values below to false before deployment -->
          <serviceMetadata httpsGetEnabled="True" httpsGetUrl="MyService.svc"/>
          <!-- To receive exception details in faults for debugging purposes, 
          set the value below to true.  Set to false before deployment 
          to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="True" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="WcfTLSLib.MyService" behaviorConfiguration="NewBehavior">

        <!-- Service Endpoints -->
        <!-- Unless fully qualified, address is relative to base address supplied above -->
        <endpoint address="" binding="wsHttpBinding" contract="WcfTLSLib.MyInterface" bindingConfiguration="Binding">
          <!--  
              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="MyMachine"/>
          </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="mexHttpsBinding" contract="IMetadataExchange"/>
        <host>
          <baseAddresses>
            <add baseAddress = "https://MyMachine:8733/Design_Time_Addresses/WcfTLSLib/MyService" />
          </baseAddresses>
        </host>
      </service>
    </services>

    <bindings>
      <wsHttpBinding>
        <binding name="Binding">
          <security mode="Transport">
            <transport clientCredentialType="None">

            </transport>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
  </system.serviceModel>

</configuration>

0 个答案:

没有答案