WCF开发框架之Winform客户端配置文件 - App.config
![]() ![]() WCF开发框架之Winform客户端配置文件 - App.config App.Config文件 文件说明 ![]() ![]() ![]() ![]() XML Code: <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <sectionGroup name="system.data.dataset.serialization" type="System.Data.SerializationSettingsSectionGroup, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <section name="allowedTypes" type="System.Data.AllowedTypesSectionHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> </sectionGroup> </configSections> <system.data.dataset.serialization> <allowedTypes> <!-- <add type="assembly qualified type name" /> --> <add type="MySql.Data.Types.MySqlDateTime, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> <!-- additional <add /> elements as needed --> </allowedTypes> </system.data.dataset.serialization> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/> </startup> <appSettings> <!--【此配置已取消】:是否使用HTTPS协议 true/false --> <!-- WCFFactory.Create<T>方法使用:--> <!-- 1.若WCF服务器基于https协议,必须设置为:true --> <!-- 2.开发环境(本地测试)设置为:false --> <add key="UseHttps" value="false"/> <!--支持4种凭据类型:None/Basic/Windows/Certificate--> <!--默认为None,不需要凭据--> <add key="UseCredentials" value="None"/> <!--SSL证书密码--> <add key="SSLPassword" value="V6gTKX+nZUB+5imSHNpMTg=="/> <!--Basic/Windows凭据账号和密码,请使用KeyProvider.Default.Decrypt解密--> <add key="Windows_UserName" value="HS+AHKm26rokVfWqabT5TA=="/> <add key="Windows_Password" value="Snj6+Q3dGGb1ukbEi0igFw=="/> <!--开发环境(本地测试):IIS承载的WCF服务地址(HTTP)协议,支持:wsHttpBinding/basicHttpBinding两种协议--> <add key="ICommonService" value="http://localhost:23270/CommonService.svc"/> <add key="IDataDictService" value="http://localhost:23270/DataDictService.svc"/> <add key="IMessageCenter" value="http://localhost:23270/MessageCenter.svc"/> <add key="ISystemSecurityService" value="http://localhost:23270/SystemSecurityService.svc"/> <add key="IAccountModuleService" value="http://localhost:23270/AccountModuleService.svc"/> <add key="IPurchaseModuleService" value="http://localhost:23270/PurchaseModuleService.svc"/> <add key="ISalesModuleService" value="http://localhost:23270/SalesModuleService.svc"/> <add key="IInventoryModuleService" value="http://localhost:23270/InventoryModuleService.svc"/> <add key="IHR" value="http://localhost:23270/HR.svc"/> <!--正式环境(发布部署):IIS承载的WCF服务地址(HTTPS)协议,CSFramework阿里云测试服务器--> <!-- <add key="ICommonService" value="https://cs5.manonwo.com/CommonService.svc"/> <add key="IDataDictService" value="https://cs5.manonwo.com/DataDictService.svc"/> <add key="IMessageCenter" value="https://cs5.manonwo.com/MessageCenter.svc"/> <add key="ISystemSecurityService" value="https://cs5.manonwo.com/SystemSecurityService.svc"/> --> </appSettings> <!--WCF服务-客户端配置--> <system.serviceModel> <bindings> <!--WSHttpBinding 绑定配置--> <wsHttpBinding> <binding name="WSHttpBinding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <!--HTTP协议:<security mode="None"> --> <!--HTTPS协议:<security mode="Transport"> --> <!--默认http协议+Message安全模式+Windows认证--> <security mode="Message"> <transport clientCredentialType="Windows" proxyCredentialType="None" /> <!--若安全模式=Message,negotiateServiceCredential必须设置true--> <message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="false" /> </security> </binding> </wsHttpBinding> <!--BasicHttpBinding 绑定配置--> <basicHttpBinding> <binding name="BasicHttpBinding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" /> <security mode="Message"> <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> <!--NetTcpBinding 绑定配置--> <netTcpBinding> <binding name="NetTcpBinding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="Message"> <transport clientCredentialType="Windows" protectionLevel="None"/> <message clientCredentialType="Windows" /> </security> </binding> </netTcpBinding> </bindings> <!--endpoint的行为配置:behaviorConfiguration--> <!--用于Certificate认证模式:配置客户端SSL证书信息--> <!--1.添加服务应用方式,可通过此配置信息设置WCF行为,参考WCFTester里面的例子--> <!--2.透明代理工厂,加载SSL证书文件,参考WCFFactory.CreateCertificate<T>--> <behaviors> <endpointBehaviors> <behavior name="SSL_ClientBehavior"> <clientCredentials> <clientCertificate findValue="cs5.manonwo.com" storeLocation="LocalMachine" x509FindType="FindBySubjectName" storeName="My"/> <serviceCertificate> <authentication certificateValidationMode="PeerOrChainTrust"/> </serviceCertificate> </clientCredentials> </behavior> </endpointBehaviors> </behaviors> </system.serviceModel> </configuration> //来源:C/S框架网 | www.csframework.com | QQ:23404761 ![]() 扫一扫加作者微信 ![]() ![]()
参考文档:
CS开发框架的客户端可以自动生成吗? 基于C/S三层架构的WCF开发框架接口调用流程|C/S框架网 Winform快速开发框架之存储图片资源解决方案|C/S框架网 基于Winform三层架构+WCF+ORM模型的快速开发框架 WCF开发框架之ICommunicationObject 对象详解 WCF开发框架之WSHttpBinding参数配置(C#代码配置+App.Config两种方案) WCF开发框架IIS承载WCF - Website站点承载改为ASP.NET网站应用程序承载 WCF开发框架 - BasicHttpBinding绑定的web.config与C#代码配置(支持https协议) 【原创】WCF开发框架 - 采用wsHttpBinding及basicHttpBinding连接https协议的WCF服务 Winform企业级WCF快速开发框架平台(C/S架构+WCF+DevExpress+SQL多数据库) WCF开发框架-客户端采用BASIC身份认证调用HTTPS协议WCF接口 WCF开发框架-客户端采用Windows身份认证调用HTTPS协议WCF接口 WCF开发框架-客户端采用Certificate认证模式调用基于HTTPS协议的WCF接口 WCF开发框架默认连接:HTTP协议+Message安全模式+Windows客户端认证 WCF开发框架之WCF服务器配置文件 - Web.config
其它资料:
什么是C/S结构? | C/S框架核心组成部分 | C/S框架-WebService部署图 | C/S框架-权限管理 | C/S结构系统框架 - 5.1旗舰版介绍 | C/S结构系统框架 - 功能介绍 | C/S结构系统框架 - 产品列表 | C/S结构系统框架 - 应用展示(图) | 三层体系架构详解 | C/S架构轻量级快速开发框架 | C/S框架网客户案例 | WebApi快速开发框架 | C/S框架代码生成器 | 用户授权注册软件系统 | 版本自动升级软件 | 数据库底层应用框架 | CSFramework.CMS内容管理系统 | |