WCF开发框架之WCF服务器配置文件 - Web.config
作者:作者不详  发布日期:2021/11/16 18:34:08
  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框架网|原创精神.创造价值.打造精品


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