WCF开发框架之WCF服务器配置文件 - Web.config
WCF开发框架之WCF服务器配置文件 - Web.config
WCF开发框架之WCF服务器配置文件 - Web.config Web.Config文件 文件适用版本: 文件说明: SystemConnectionString:数据库连接字符串,采用Rijndael Encrypt加密算法。 提供三种常用绑定方式:wsHttpBinding,basicHttpBinding,netTcpBinding 提供标准的行为配置:<behavior name="myBehavior"> 支持http/https协议:security mode XML Code: <?xml version="1.0"?> <configuration> <appSettings> <!--SQLServer系统数据库连接配置--> <!--Server=.;Database=CSFrameworkV5_System;User ID=sa;Password=test;Pooling=true;Max Pool Size =1024;--> <add key="SystemConnectionString" value="IgckizkV8yaU7EEYXcpGllNd3CBi6rLDWkAlr+EMVxt6+WTP2xYvBpOCTWg1BTNtulZ0P6DHC2iN3rqGRBNDlbxO8i0x0fidsSNb8uA03XxtXFw/xvgFml5GqMZQSYHlWb317JDppfAOaYh0r4gssarA=="/> <!--是否检查客户端恶意攻击--> <add key="AttackValidation" value="false"/> <!--数据库类型(SqlServer,Oracle,MySQL)--> <add key="DatabaseType" value="SqlServer"/> </appSettings> <connectionStrings/> <!--WCF服务配置--> <system.serviceModel> <protocolMapping> <!--tcp地址使用netTcpBinding作为默认绑定类型--> <!--<add scheme="tcp" binding="netTcpBinding"/>--> <!--http地址使用wsHttpBinding作为默认绑定类型--> <add scheme="http" binding="wsHttpBinding"/> </protocolMapping> <!--支持多个IIS站点绑定,同时支持http/https--> <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/> <!--CSFrameworkV5.1提供以下3种binding配置, 您只需要选择其中一种即可!--> <bindings> <!--wsHttpBindings配置 --> <wsHttpBinding> <binding name="WSHttpBindings" 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"/> <security mode="Message"> <transport clientCredentialType="Windows" proxyCredentialType="None"/> <message clientCredentialType="Windows" establishSecurityContext="false" negotiateServiceCredential="true"/> </security> </binding> </wsHttpBinding> <!--basicHttpBinding配置--> <basicHttpBinding> <binding name="BasicHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="524288" 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="Certificate" algorithmSuite="Default"/> </security> </binding> </basicHttpBinding> <!--netTcpBinding配置--> <netTcpBinding> <binding name="NetTcpBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="1048576" maxConnections="10" maxReceivedMessageSize="1048576"> <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> <!--WCF服务配置,注意!!!您创建的WCF服务必须在此配置!!!--> <services> <service behaviorConfiguration="myBehavior" name="CSFrameworkV5.WCFContract.WCF_Class.CommonService"> <endpoint address="" binding="wsHttpBinding" bindingConfiguration="WSHttpBindings" contract="CSFrameworkV5.WCFContract.ICommonService"> <identity> <dns value="localhost"/> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> <service behaviorConfiguration="myBehavior" name="CSFrameworkV5.WCFContract.WCF_Class.DataDictService"> <endpoint address="" binding="wsHttpBinding" bindingConfiguration="WSHttpBindings" contract="CSFrameworkV5.WCFContract.IDataDictService"> <identity> <dns value="localhost"/> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> <service behaviorConfiguration="myBehavior" name="CSFrameworkV5.WCFContract.WCF_Class.SystemSecurityService"> <endpoint address="" binding="wsHttpBinding" bindingConfiguration="WSHttpBindings" contract="CSFrameworkV5.WCFContract.ISystemSecurityService"> <identity> <dns value="localhost"/> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> <service behaviorConfiguration="myBehavior" name="CSFrameworkV5.WCFContract.WCF_Class.MessageCenter"> <endpoint address="" binding="wsHttpBinding" bindingConfiguration="WSHttpBindings" contract="CSFrameworkV5.WCFContract.IMessageCenter"> <identity> <dns value="localhost"/> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <!--WCF服务配置 通用行为配置--> <behaviors> <serviceBehaviors> <behavior name="myBehavior"> <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false"/> <serviceDebug includeExceptionDetailInFaults="false"/> <serviceThrottling maxConcurrentCalls="200" maxConcurrentSessions="200" maxConcurrentInstances="200"/> <!--开启审计安全事件的服务--> <serviceSecurityAudit auditLogLocation="Application" messageAuthenticationAuditLevel="SuccessOrFailure" serviceAuthorizationAuditLevel="SuccessOrFailure" suppressAuditFailure="true"/> <!--若采用Certificate凭据认证,配置SSL证书信息 <serviceCredentials> <serviceCertificate x509FindType="FindBySubjectName" storeLocation="CurrentUser" storeName="My" findValue="cs5.manonwo.com"/> </serviceCredentials> --> <!--<serviceCredentials> <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="CSFrameworkV5.WCFContract.WCF_UserNamePasswordValidator,CSFrameworkV5.WCFContract" /> </serviceCredentials>--> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> <staticContent> <mimeMap fileExtension=".svc" mimeType="application/octet-stream"/> </staticContent> <httpProtocol> <customHeaders> <add name="X-Content-Type-Options" value="nosniff"/> </customHeaders> </httpProtocol> </system.webServer> <system.web> <compilation debug="true" targetFramework="4.5"/> <customErrors defaultRedirect="err.html" mode="On" redirectMode="ResponseRedirect"> <error redirect="err.html" statusCode="404"/> </customErrors> <authentication mode="Windows"/> <httpRuntime executionTimeout="10800" maxRequestLength="2097151" useFullyQualifiedRedirectUrl="false" minFreeThreads="32" minLocalRequestFreeThreads="32" appRequestQueueLimit="100"/> <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/> </system.web> </configuration> //来源:C/S框架网 | www.csframework.com | QQ:23404761 扫一扫加作者微信
参考文档:
C/S开发框架企业版增加WCF服务自承载实时调试后台程序 C/S系统快速开发平台采用Windows服务承载的WCF服务器 WCF开发框架之ICommunicationObject 对象详解 WCF开发框架之WSHttpBinding参数配置(C#代码配置+App.Config两种方案) WCF开发框架IIS承载WCF - Website站点承载改为ASP.NET网站应用程序承载 WCF开发框架 - BasicHttpBinding绑定的web.config与C#代码配置(支持https协议) WCF开发框架-IIS启用net.tcp协议发现不会自动执行Global应用程序解决方案 WCF开发框架 - vs发布IIS承载(IIS Hosting)的WCF应用服务详解 WCF快速开发框架 - IIS承载WCF服务wsHttpBindings配置详解(HTTP协议) 【原创】WCF开发框架 - 采用wsHttpBinding及basicHttpBinding连接https协议的WCF服务 CSFramework WCF开发框架 - 多个WCF服务接口合并到一个svc服务 WCF开发框架-客户端采用BASIC身份认证调用HTTPS协议WCF接口 WCF开发框架-客户端采用Certificate认证模式调用基于HTTPS协议的WCF接口 WCF开发框架默认连接:HTTP协议+Message安全模式+Windows客户端认证 .Net开发服务器服务端应用程序 - WebApi后端开发框架
其它资料:
什么是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内容管理系统 | |