2路SSL authontication ..wpf客户端和WCF服务 [英] 2 way SSL authontication ..wpf client and WCF service

查看:87
本文介绍了2路SSL authontication ..wpf客户端和WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello团队,



我正在WPF中设计应用程序,我想通过2路ssl身份验证连接wcf服务..



我已生成客户端 - 服务器证书和pfx文件。 



我在IIS上有导入服务证书,在控制台根目录上有客户端证书。

但是我收到很多错误,比如



 HTTP请求未经授权使用客户端身份验证方案' 匿名'。从服务器' '









这个是我在客户端的配置



 <?  xml     version   =  1.0   编码  =  utf-8    >  
< ; 配置 >
< startup >
< span class =code-keyword>< supportedRuntime version = v4.0 sku = 。NETFramework ,版本= v4.5 / >

< / startup >

< system.serviceModel >
< bindings >
< < span class =code-leadattribute> wsHttpBinding >
< binding name = WSHttpBinding_IBTA_Service >
< security 模式 = 传输​​ >
< transport clientCredentialType = 证书 / >
< / security >
< / binding >
< / wsHttpBinding >
< / bindings >
< 客户 >
< 端点 地址 = https://172.16.50.146:12466/BTA_Service.svc

binding = wsHttpBinding bindingConfiguration < span class =code-keyword> = WSHttpBinding_IBTA_Service
< span class =code-attribute>
< span class =code-attribute> 合同 = BTA_Service.IBTA_Service 名称 = < span class =code-keyword> WSHttpBinding_IBTA_Service behaviorConfiguration = EndpointBehavior / >


< < span class =code-leadattribute> / client >
< 行为 < span class =code-keyword>>
< endpointBehaviors >
< 行为 name = EndpointBehavior >
< clientCredentials >
< < span class =code-leadattribute> clientCertificate storeLocation = LocalMachine

storeName = 我的

< span class =code-attribute> x509FindType = FindByThumbprint

< span class =code-attribute> findValue = 3a396124e4435f661d8b211ea5ae118c132f5b34 / >
< / clientCredentials >
< / behavior >
< / endpointBehaviors >
< / behavior >
< / system.serviceModel >




< / configuration >





服务水平配置



 <?  xml     version   =  1.0  >  
< configuration >
<! - < System.Diagnostics程序>
< sources>
< source propagateActivity =truename =System.ServiceModelswitchValue =Warning,ActivityTracing>
< listeners>
< add type =System.Diagnostics.DefaultTraceListenername =Default>
< filter type =/>
< / add>
< add name =ServiceModelTraceListener>
< filter type =/>
< / add>
< / listeners>
< / source>
< / sources>
< sharedListeners>
< add initializeData =d:\ gallello \gallellomvc\bta_wcf_service\web_tracelog.svclog
type =System.Diagnostics.XmlWriterTraceListener,System,Version = 4.0.0.0,Culture =中性,PublicKeyToken = b77a5c561934e089
name =ServiceModelTraceListenertraceOutputOptions =Timestamp>
< filter type =/>
< / add>
< / sharedListeners>
< /system.diagnostics>
- >

< system.web >
< 编译 debug = true targetFramework = 4.5 / >
< pages controlRenderingCompatibilityVersion = 4.0 / >
< / system.web >
< connectionStrings >
< add name = GDS_Connection connectionString = F5XGWMkZIKnvmeKRLmDIs85gfShEhVsCb31D96JcpdLpltZWV3RBdpfwwCVPeOPz5EcrGS0 / 6c2N / s3sV9TIiNokGMnzuptigq6kJQHbpAWo6G0mBWlIag == / >
< / connectionStrings >
< system.serviceModel >
< 服务 >
< service name = BTA_WCF_Service.BTA_Service >
< span class =code-keyword>< endpoint address = binding = wsHttpBinding bindingConfiguration = TransportSecurity

< span class =code-attribute> 合同 = BTA_WCF_Service.IBTA_Service / >
< endpoint 地址 = mex binding = mexHttpsBinding 合同 = IMetadataExchange / >
< / service >
< / services >
< 绑定 >
< < span class =code-leadattribute> wsHttpBinding >
< binding name = TransportSecurity >
< security 模式 = 传输​​ >
< transport clientCredent ialType = 证书 / >
< / security >
< / binding >
< / wsHttpBinding >
< / bindings >
< 行为 >
< serviceBehaviors >
< 行为 >
< serviceMetadata httpsGetEnabled = true < span class =code-keyword> /
>
< serviceDebug includeExceptionDetailInFaults = false / >
< serviceCredentials >
< serviceCertificate storeLocation = LocalMachine x509FindType = FindBySubjectDistinguishedName storeName = 我的 findValue = localhost / >
< / serviceCredentials >
< / behavior >
< / serviceBehaviors >
< / behavior >
< serviceHostingEnvironment multipleSiteBindingsEnabled = / >
< / system.serviceModel >
< system.webServer >
< modules runAllManagedModulesForAllRequests = true / >
<! -
要在调试期间浏览Web应用程序根目录,请将以下值设置为true。
在部署之前设置为false以避免泄露Web应用程序文件夹信息。
- >

< directoryBrowse 已启用 = true / >
< / system.webServer >
< / configuration >









请给我简要的解释和演示解决方案..



我尝试过:



错误: -

 HTTP请求未经授权使用客户端身份验证方案' 匿名'。从服务器' '





请解释一下2路ssl认证的整个过程

解决方案

了解如何使用谷歌。



双向ssl通信 - Google搜索 [ ^

Hello team,

I am designing application in WPF and I want to connect wcf service through 2 way ssl authentication..

I have generated client-server  certificate and pfx file. 


I have import service certificate on IIS and client certificate on console root .
but still I am getting many error like

The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was ''.





this is my config at client side

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />

  </startup>

  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IBTA_Service">
          <security mode="Transport">
            <transport clientCredentialType="Certificate" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://172.16.50.146:12466/BTA_Service.svc"

        binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IBTA_Service"

        contract="BTA_Service.IBTA_Service" name="WSHttpBinding_IBTA_Service " behaviorConfiguration="EndpointBehavior" />

     
    </client>
    <behaviors>
      <endpointBehaviors>
            <behavior name="EndpointBehavior">
              <clientCredentials>
                <clientCertificate storeLocation="LocalMachine"

                                   storeName="My"

                                   x509FindType="FindByThumbprint"

                                   findValue="3a396124e4435f661d8b211ea5ae118c132f5b34"/>
              </clientCredentials>
            </behavior>
          </endpointBehaviors>
        </behaviors>
  </system.serviceModel>
 
   

  
</configuration>



Service level config is

<?xml version="1.0"?>
<configuration>
  <!--<system.diagnostics>
    <sources>
      <source propagateActivity="true" name="System.ServiceModel" switchValue="Warning,ActivityTracing">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelTraceListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="d:\gallello\gallellomvc\bta_wcf_service\web_tracelog.svclog"
        type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
    </sharedListeners>
  </system.diagnostics>-->
  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <pages controlRenderingCompatibilityVersion="4.0"/>
  </system.web>
  <connectionStrings>
    <add name="GDS_Connection" connectionString="F5XGWMkZIKnvmeKRLmDIs85gfShEhVsCb31D96JcpdLpltZWV3RBdpfwwCVPeOPz5EcrGS0/6c2N/s3sV9TIiNokGMnzuptigq6kJQHbpAWo6G0mBWlIag=="/>
  </connectionStrings>
  <system.serviceModel>
    <services>
      <service name="BTA_WCF_Service.BTA_Service">
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="TransportSecurity"

          contract="BTA_WCF_Service.IBTA_Service" />
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="TransportSecurity">
          <security mode="Transport">
            <transport clientCredentialType="Certificate"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
          <serviceCredentials>
            <serviceCertificate storeLocation="LocalMachine" x509FindType="FindBySubjectDistinguishedName" storeName="My" findValue="localhost"/>  
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="True"/>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>





Please give me brief explaining and demo solution for the same..

What I have tried:

ERROR :-

The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was ''.

.

Please explain me entire process of 2 way ssl authentication

解决方案

Learn how to use google.

2-way ssl communications - Google Search[^]


这篇关于2路SSL authontication ..wpf客户端和WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆