• TcpServerChannel 类服务


    服务端

                var provider = new BinaryServerFormatterSinkProvider();
                provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

                IDictionary props = new Hashtable();
                props["name"] = "ServerPacs";
                props["port"] = port.toInt();
                props["typeFilterLevel"] = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

                props["secure"] = true; 打开认证;
                props["impersonate"] = true;
                props["protectionLevel"] = System.Net.Security.ProtectionLevel.Sign;

               var tcpserver = new TcpServerChannel(props, provider, Auth);

                ChannelServices.RegisterChannel(tcpserver, true);/打开认证;

           

    客户端:

                    var bcprovider = new BinaryClientFormatterSinkProvider();
                    IDictionary props = new Hashtable();

                    props["name"] = "ServerPacs";
                    props["secure"] = true;
                    props["impersonate"] = true;
                    props["protectionLevel"] = System.Net.Security.ProtectionLevel.Sign;
                    props["tokenImpersonationLevel"] = System.Security.Principal.TokenImpersonationLevel.Impersonation;
                    //props["authorizationModule"] = "PacsClassServer.AuthorizationModule,hello";
                    //props["useDefaultCredentials"] = "false";
                    //props["domain"] = "172_21_0_15";
                    props["username"] = "admin";
                    props["password"] = "xxxx;   
                    var client = new TcpClientChannel(props, bcprovider);
                    ChannelServices.RegisterChannel(client, true);

    在服务器操作系统上建立一个新账号,在客户端配置,即可完整认证。

  • 相关阅读:
    jvm的jshell,学生的工具
    纸箱码垛机:从传统到智能,科技如何助力产业升级
    写过的最蠢的代码
    Android 自定义加载动画LoadingView
    509 - RAID! (UVA)
    【Webpack5】Webpack学习笔记(一)
    小程序自定义组件(附“我的“页面item组件代码)
    TNF6TOA TNF5TOA 全新板卡8路任意速率业务支路处理板
    SpringCloud简单的远程调用Demo
    基于Java的宠物用品商城管理系统设计与实现(源码+lw+部署文档+讲解等)
  • 原文地址:https://blog.csdn.net/joman5/article/details/132739823