zoukankan      html  css  js  c++  java
  • 使用SSL的IIS下WCF配置(CSDN手动迁移)

    在WCF的WebConfig配置http绑定,并设置为使用传输安全性,如下所示

    1     <bindings>
    2       <basicHttpBinding>
    3         <binding name="secureHttpBinding">
    4           <security mode="Transport">
    5             <transport clientCredentialType="None"/>
    6           </security>
    7         </binding>
    8       </basicHttpBinding>
    9     </bindings>

    指定服务和服务终结点

    1     <services>  
    2       <service name="WCF.Service" >  
    3         <endpoint contract="WCF.IService" address="" binding="basicHttpBinding" bindingConfiguration="secureHttpBinding"></endpoint>  
    4         <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /><!--这里为固定写法-->  
    5       </service>  
    6     </services> 

    完整WebConfig如下:

     1 <?xml version="1.0" encoding="utf-8"?>  
     2 <configuration>  
     3   
     4   <system.web>  
     5     <compilation targetFramework="4.0" />  
     6   </system.web>  
     7   <system.serviceModel>  
     8   
     9     <bindings>  
    10       <basicHttpBinding>  
    11         <binding name="secureHttpBinding">  
    12           <security mode="Transport">  
    13             <transport clientCredentialType="None"/>  
    14           </security>  
    15         </binding>  
    16       </basicHttpBinding>  
    17     </bindings>  
    18       
    19     <services>  
    20       <service name="WCF.Service" >  
    21         <endpoint contract="WCF.IService" address="" binding="basicHttpBinding" bindingConfiguration="secureHttpBinding"></endpoint>  
    22         <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /><!--这里为固定写法-->  
    23       </service>  
    24     </services>  
    25   
    26     <behaviors>  
    27       <serviceBehaviors>  
    28         <behavior>  
    29           <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false -->  
    30           <serviceMetadata httpsGetEnabled="true" />  
    31           <!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息 -->  
    32           <serviceDebug includeExceptionDetailInFaults="false" />  
    33         </behavior>  
    34       </serviceBehaviors>  
    35     </behaviors>  
    36       
    37     <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />  
    38   </system.serviceModel>  
    39   <system.webServer>  
    40     <modules runAllManagedModulesForAllRequests="true" />  
    41     <!--  
    42         若要在调试过程中浏览 Web 应用程序根目录,请将下面的值设置为 True。  
    43         在部署之前将该值设置为 False 可避免泄露 Web 应用程序文件夹信息。  
    44       -->  
    45     <directoryBrowse enabled="true" />  
    46   </system.webServer>  
    47   
    48 </configuration>  
  • 相关阅读:
    implement the bucket sort and some analysis
    冪運匴
    polynomial multiplication
    WinRAR(WinZip)压缩与解压实现(C#版Window平台)
    Windows 窗体计时器事件,则不引发在 Windows 服务
    VS 2008智能提示是英文的怎么改成中文的?
    C#_SQL数据访问帮助类
    C#_DllImport用法和路径问题
    Office2003/2007/2010强力卸载工具下载
    Windows_装的是2008R2系统,在电脑属性里显示内存12G(可用4G)
  • 原文地址:https://www.cnblogs.com/hetring/p/4611256.html
Copyright © 2011-2022 走看看