• 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);

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

  • 相关阅读:
    学习笔记:机器学习之支持向量机(SVM)(上)
    Python 类型注解
    一、利用固件库模板点灯(附模板及案例程序)
    商城数据库设计说明书
    Linux环境基础开发工具
    python深度学习入门-从零构建CNN和RNN
    实现异步转同步的几种方式
    Java 之JSch实现ssh远程操作
    用AI把你的故事变成歌曲,创作一首只属于你的歌
    C++ string常用函数用法总结
  • 原文地址:https://blog.csdn.net/joman5/article/details/132739823