C#编码直接调用WCF服务时协议参数设置


  C#编码直接调用WCF服务时协议参数设置



C#调用WCF服务时,需要设置协议,下面的代码介绍了C#调用WCF服务时协议的设置情况,具体代码如下:

PS: WCF大数量传输参数设置

C# Code:

private WSHttpBinding GetWSHttpBinding()
{
   //wsHttpBinding
   WSHttpBinding ws = new WSHttpBinding(SecurityMode.None);
   ws.CloseTimeout = new TimeSpan(0, 1, 0);
   ws.OpenTimeout = new TimeSpan(0, 1, 0);
   ws.ReceiveTimeout = new TimeSpan(0, 20, 0);
   ws.SendTimeout = new TimeSpan(0, 1, 0);
   ws.BypassProxyOnLocal = false;
   ws.TransactionFlow = false;
   ws.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
   ws.MaxBufferPoolSize = 524288; //获取或设置可为缓冲区管理器分配的最大内存量
   ws.MaxReceivedMessageSize = 2147483647;//获取或设置可由绑定处理的消息的最大大小
   ws.MessageEncoding = WSMessageEncoding.Text;
   ws.TextEncoding = Encoding.UTF8;
   ws.UseDefaultWebProxy = true;
   ws.AllowCookies = false;
   ws.ReaderQuotas.MaxDepth = 6553600;//Gets and sets the maximum nested node depth
   ws.ReaderQuotas.MaxStringContentLength = 2147483647;//Gets and sets the maximum string length returned by the reader
   ws.ReaderQuotas.MaxArrayLength = 6553600;//Gets and sets the maximum allowed array length
   ws.ReaderQuotas.MaxBytesPerRead = 6553600;// Gets and sets the maximum allowed bytes returned for each read
   ws.ReaderQuotas.MaxNameTableCharCount = 6553600;//Gets and sets the maximum characters allowed in a table name
   ws.ReliableSession.Ordered = true;
   ws.ReliableSession.InactivityTimeout = new TimeSpan(0, 20, 0);
   ws.ReliableSession.Enabled = true;
   ws.Security.Mode = SecurityMode.None;
   ws.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
   ws.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
   ws.Security.Transport.Realm = "";
   ws.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
   ws.Security.Message.NegotiateServiceCredential = true;
   ws.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default;
   ws.Security.Message.EstablishSecurityContext = false;
   
   
   return ws;
}

//来源:C/S框架网(www.csframework.com) QQ:1980854898




 



C/S框架网|原创精神.创造价值.打造精品


扫一扫加作者微信
C/S框架网作者微信 C/S框架网|原创作品.质量保障.竭诚为您服务


版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
C/S框架网
上一篇:WCF揭秘—可靠性会话功能
下一篇:高级版:保存附件性能优化
评论列表

发表评论

评论内容
昵称:
关联文章

C#编码直接调用WCF服务协议参数设置
WCF开发框架-客户端采用BASIC身份认证调用HTTPS协议WCF接口
WCF开发框架-客户端采用Certificate认证模式调用基于HTTPS协议WCF接口
WCF开发框架-客户端采用Windows身份认证调用HTTPS协议WCF接口
vs使用透明代理工厂方式调用HTTPS协议WCF服务
提供的URI方案http无效,应为https,参数名via - WCF服务采用HTTPS协议
vs使用添加服务引用方式连接HTTPS协议WCF服务
【原创】WCF开发框架 - 采用wsHttpBinding及basicHttpBinding连接https协议WCF服务
承载 Service Host 和使用 WCF 服务
WCF:SecurityNegotiationException 调用方未由服务进行身份验证
C#.NET VS2015运行调试Windows服务(宿主)承载的WCF程序
C#.NET VS2015运行调试Windows服务承载的WCF程序(新)
WCF快速开发框架 - IIS承载WCF服务wsHttpBindings配置详解(HTTP协议)
WCF服务错误:System.TimeoutException: 请求通道在等待 00:01:00 以后答复超时
安装WCF服务-安装Windows服务(System.ComponentModel.Win32Exception:远程过程调用失败)
WCF顶级安全:HTTPS协议SSL证书+Windows认证+TransportWithMessageCredential安全模式
C#直接使用DllImport外部Dll的方法
C# 判断字符串为空值设置默认值
原创WebApi框架:采用HTTPS协议SelfHosting,Windows服务承载WebApi服务
WCF开发框架默认连接:HTTP协议+Message安全模式+Windows客户端认证

热门标签
.NET5 .NET6 .NET7 APP Auth-软件授权注册系统 Axios B/S B/S开发框架 Bug Bug记录 C#加密解密 C#源码 C/S CHATGPT CMS系统 CodeGenerator CSFramework.DB CSFramework.EF CSFrameworkV1学习版 CSFrameworkV2标准版 CSFrameworkV3高级版 CSFrameworkV4企业版 CSFrameworkV5旗舰版 CSFrameworkV6.0 DAL数据访问层 Database datalock DbFramework Demo教学 Demo下载 DevExpress教程 DOM EF框架 Element-UI EntityFramework ERP ES6 Excel FastReport GIT HR IDatabase IIS JavaScript LINQ MES MiniFramework MIS NavBarControl Node.JS NPM OMS ORM PaaS POS Promise API Redis SAP SEO SQL SQLConnector TMS系统 Token令牌 VS2022 VSCode VUE WCF WebApi WebApi NETCore WebApi框架 WEB开发框架 Windows服务 Winform 开发框架 Winform 开发平台 WinFramework Workflow工作流 Workflow流程引擎 版本区别 报表 踩坑日记 操作手册 代码生成器 迭代开发记录 基础资料窗体 架构设计 角色权限 开发sce 开发技巧 开发教程 开发框架 开发平台 开发指南 客户案例 快速搭站系统 快速开发平台 秘钥 密钥 权限设计 软件报价 软件测试报告 软件简介 软件开发框架 软件开发平台 软件开发文档 软件体系架构 软件下载 软著证书 三层架构 设计模式 生成代码 实用小技巧 收钱音箱 数据锁 数据同步 微信小程序 未解决问题 文档下载 喜鹊ERP 喜鹊软件 系统对接 详细设计说明书 行政区域数据库 需求分析 疑难杂症 蝇量级框架 蝇量框架 用户管理 用户开发手册 用户控件 在线支付 纸箱ERP 智能语音收款机 自定义窗体 自定义组件 自动升级程序