当前位置:编程学习 > C#/ASP.NET >>

WCF服务端配置搞不懂了..

提示,不支持https
开发环境:windowsXP vs2008
web.config:
<system.serviceModel>
    <services>
      <service name="WCF.Service1" behaviorConfiguration="WCF.Service1Behavior">
        <!-- Service Endpoints -->
        <endpoint address="https://localhost/wcf" binding="wsHttpBinding" contract="WCF.IService1" bindingConfiguration="NewBinding0">
          <!-- 
              部署时,应删除或替换下列标识元素,以反映
              在其下运行部署服务的标识。删除之后,WCF 将
              自动推导相应标识。
          -->
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WCF.Service1Behavior">
          <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false 并删除上面的元数据终结点-->
          <serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost" />
          <!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息-->
          <serviceDebug includeExceptionDetailInFaults="true"/>
            <serviceCredentials>
                <clientCertificate>
                    <authentication certificateValidationMode="Custom" customCertificateValidatorType="WCF.CustomX509CertificateValidator,WCF"/>
                </clientCertificate>
                <serviceCertificate findValue="CAcert WoT User" storeLocation="LocalMachine" x509FindType="FindBySubjectName"/>
            </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
     <bindings>
         <wsHttpBinding>
             <binding name="NewBinding0">
                 <security mode="Transport">
                     <transport clientCredentialType="Certificate"/>
                 </security>
             </binding>
         </wsHttpBinding>
     </bindings>
  </system.serviceModel> --------------------编程问答-------------------- 看不来 什么问题 --------------------编程问答-------------------- <endpoint address="https://localhost/wcf" binding="wsHttpBinding" contract="WCF.IService1" bindingConfiguration="NewBinding0"> 
楼主此处出错了,address="https://localhost/wcf"应该为address="http://localhost/wcf"就OK --------------------编程问答--------------------
引用 2 楼 anyeyouling_lk 的回复:
<endpoint address="https://localhost/wcf" binding="wsHttpBinding" contract="WCF.IService1" bindingConfiguration="NewBinding0">
楼主此处出错了,address="https://localhost/wcf"应该为address="http://localhost/wcf"就OK


不知道别 瞎说   <security mode="Transport">  支持 https --------------------编程问答-------------------- 谢谢三楼的,的确是我错了,wsHttpBinding支持SSL. --------------------编程问答-------------------- 或许跟配置无关,本地IIS应支持SSL才行吧。对IIS环境配置来支持HTTPS --------------------编程问答--------------------
引用 5 楼 ddangerous169 的回复:
或许跟配置无关,本地IIS应支持SSL才行吧。对IIS环境配置来支持HTTPS


may be not , I used to access the server through hppts, only need username and password. so I think that may be config issue --------------------编程问答-------------------- 正在学习中 --------------------编程问答-------------------- --------------------编程问答-------------------- <webHttpBinding>
        <binding name="httpsBinding">
          <security mode="Transport">
            <!--<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />-->
          </security>
        </binding>
</webHttpBinding>

你注意那个<security mode="Transport">就行了 --------------------编程问答-------------------- 另外注意,再别用那个 <wsHttpBinding>,有很多例子是用这个,从我的经验来看,基于web的应用,最好都用
<webHttpBinding>
补充:.NET技术 ,  Web Services
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,