• dhl:The request for security token could not be satisfied because authentication failed. 调用方未由服务进行身份验证。


    The request for security token could not be satisfied because authentication failed.

    [SecurityNegotiationException: 调用方未由服务进行身份验证。]

    解决方法:
    在服务端配置文件添加<binding>配置验证<Security=“none”>,客户端配置验证<Security=“none”>
    Code


     
    资料:

    一直在一台电脑上同时搞WCF的服务和客户端,今天在另外一台电脑上调用,发现了一个新的问题"调用方未由服务进行身份验证",

    在网上查了大量的资料,也没有发现有人说明白其中的原因,只是发现了一篇解决的办法,但是个人感觉不是最佳的方案,所以还在探索中.

    发现的解决的办法中提到,在服务端和客户端分别将安全验证设置成"none"就可以了,自己试了几遍也没成功.但是从理论上是行的通的.

     

    另外发现了一个解决办法,不知道有没有其它的见解

    将 WCF 服务器和客户端分别部署到不同机器上,可能会触发如下异常。
    未处理 System.ServiceModel.Security.SecurityNegotiationException
    Message="服务器已拒绝客户端凭据。"
    Source="mscorlib"
    解决方法,就是调整服务器端 Binding 的安全方式,比如设为 "None"。
    NetTcpBinding binding = new NetTcpBinding();
    binding.Security.Mode = SecurityMode.None;

    ServiceHost host = new ServiceHost(typeof(MyService));
    host.AddServiceEndpoint(typeof(IService), binding, "net.tcp://192.168.0.112:8081");

    ServiceMetadataBehavior metadata = new ServiceMetadataBehavior();
    metadata.HttpGetUrl = new Uri("http://192.168.0.112:8080");
    metadata.HttpGetEnabled = true;
    host.Description.Behaviors.Add(metadata);

    host.Open();
    或者在配置文件中设置。


  • 相关阅读:
    nginx配置文件语法高亮显示方法
    GitLab服务器搭建及配置
    Git服务器搭建及配置
    SVN-Server搭建及配置
    python之subprocess
    jenkins配置从节点
    jenkins邮箱配置以及结合ansible进行批量构建
    tomcat+svn+maven+jenkins实现自动构建
    tomcat结合memcached构建session服务器
    基于tomcat集群做session共享
  • 原文地址:https://www.cnblogs.com/dudu837/p/1553410.html
Copyright © 2020-2023  润新知