客户端:wsHttpBinding
- <?xml version="1.0" encoding="utf-8" ?>
- <configuration>
- <system.serviceModel>
- <bindings>
- <wsHttpBinding>
- <binding name="ServiceBinding" maxReceivedMessageSize="1073741824" receiveTimeout="00:05:00" sendTimeout="00:05:00">
- <security mode="None">
- <transport clientCredentialType="None"/>
- </security>
- <readerQuotas maxStringContentLength ="1073741824" maxArrayLength ="1073741824" />
- </binding>
- </wsHttpBinding>
- </bindings>
- <client>
- <!--iis host for run-->
- <endpoint address="http://localhost:4906/test.svc"
- binding="wsHttpBinding"
- bindingConfiguration="ServiceBinding"
- contract="Contract.IMyTest"
- name="TestEndpoint" />
- </client>
- </system.serviceModel>
- </configuration>
服务器
- <?xml version="1.0"?>
- <configuration>
- <configSections>
- <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
- <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
- <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
- <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
- <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
- <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
- <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
- <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
- </sectionGroup>
- </sectionGroup>
- </sectionGroup>
- </configSections>
- <appSettings/>
- <connectionStrings/>
- <system.web>
- <!--
- 设置 compilation debug="true" 可将调试符号插入
- 已编译的页面中。但由于这会
- 影响性能,因此只在开发过程中将此值
- 设置为 true。
- -->
- <compilation debug="true">
- <assemblies>
- <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
- <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
- <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
- </assemblies>
- </compilation>
- <!--
- 通过 <authentication> 节可以配置 ASP.NET 用来
- 识别进入用户的
- 安全身份验证模式。
- -->
- <authentication mode="Windows"/>
- <!--
- 如果在执行请求的过程中出现未处理的错误,
- 则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
- 开发人员通过该节可以配置
- 要显示的 html 错误页
- 以代替错误堆栈跟踪。
- <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
- <error statusCode="403" redirect="NoAccess.htm" />
- <error statusCode="404" redirect="FileNotFound.htm" />
- </customErrors>
- -->
- <pages>
- <controls>
- <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- </controls>
- </pages>
- <httpHandlers>
- <remove verb="*" path="*.asmx"/>
- <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
- </httpHandlers>
- <httpModules>
- <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- </httpModules>
- </system.web>
- <system.codedom>
- <compilers>
- <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <providerOption name="CompilerVersion" value="v3.5"/>
- <providerOption name="WarnAsError" value="false"/>
- </compiler>
- </compilers>
- </system.codedom>
- <!--
- 在 Internet 信息服务 7.0 下运行 ASP.NET AJAX 需要 system.webServer
- 节。对早期版本的 IIS 来说则不需要此节。
- -->
- <system.webServer>
- <validation validateIntegratedModeConfiguration="false"/>
- <modules>
- <remove name="ScriptModule"/>
- <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- </modules>
- <handlers>
- <remove name="WebServiceHandlerFactory-Integrated"/>
- <remove name="ScriptHandlerFactory"/>
- <remove name="ScriptHandlerFactoryAppServices"/>
- <remove name="ScriptResource"/>
- <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- </handlers>
- </system.webServer>
- <runtime>
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
- <dependentAssembly>
- <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
- <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
- <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
- </dependentAssembly>
- </assemblyBinding>
- </runtime>
- <system.serviceModel>
- <services>
- <service name="Service.SMyTest" behaviorConfiguration="ServiceBehavior">
- <host>
- <!--注意了-->
- <!--必须要有基地址 net.tcp,如果没有net基地址就不能有 http 基地址,否则报错-->
- <!--添加 http 基地址是为了方便调试,可在浏览器中浏览,也可获得元数据 【httpGetEnabled 必须为 true】-->
- <!--注意了-->
- <!--必须和 behaviorConfiguration 的属性 HttpGetEnable 配合使用-->
- <!--baseAddress 调试环境下可以根据情况设置-->
- <baseAddresses>
- </baseAddresses>
- </host>
- <!--终结点配置-->
- <!--address:服务地址 | binding:绑定类型(通信方式) | bindingConfiguration:服务终结点绑定配置名称 | contract:契约【即:命名空间.服务契约(服务接口)】-->
- <!--address, 根据生产环境实际情况设置-->
- <!--contract 根据不同应用程序设置-->
- <!--<endpoint address="" binding="netTcpBinding" bindingConfiguration="ServiceBinding" contract="Contract.IMyTest"/>-->
- <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
- <endpoint address="" binding="wsHttpBinding" bindingConfiguration="ServiceBinding" contract="Contract.IMyTest"/>
- </service>
- </services>
- <behaviors>
- <serviceBehaviors>
- <behavior name="ServiceBehavior">
- <serviceMetadata httpGetEnabled="true"/>
- <serviceDebug includeExceptionDetailInFaults="True"/>
- <!-- 配置运行时吞吐量设置,这些设置可以优化服务性能-->
- <!-- maxConcurrentCalls:该值指定整个 ServiceHost 中正在处理的最多消息数-->
- <!-- maxConcurrentInstances:获取或设置一个值,该值指定服务中可以一次执行的最多 InstanceContext 对象数-->
- <!-- maxConcurrentSessions:获取或设置一个指定 ServiceHost 对象可一次接受的最多会话数的值-->
- <serviceThrottling maxConcurrentCalls="1000" maxConcurrentInstances="1000" maxConcurrentSessions="1000"/>
- </behavior>
- </serviceBehaviors>
- </behaviors>
- <bindings>
- <wsHttpBinding>
- <binding name="ServiceBinding" receiveTimeout="00:10:00" sendTimeout ="00:10:00" maxReceivedMessageSize="999999" >
- <readerQuotas maxStringContentLength="30000" />
- <security mode="None"></security>
- </binding>
- </wsHttpBinding>
- </bindings>
- </system.serviceModel>
- </configuration>
ws2007HttpBinding 客户端
<system.serviceModel>
<bindings>
<ws2007HttpBinding>
<binding name="WS2007HttpBinding_ICenterDynamicService" maxReceivedMessageSize="2147483647" >
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Message">
<transport clientCredentialType="Windows" />
<message clientCredentialType="Windows" />
</security>
</binding>
</ws2007HttpBinding>
</bindings>
<client>
<endpoint address="http://xxxxxxx.com/Services/Activity/CenterDynamicService.svc"
binding="ws2007HttpBinding" bindingConfiguration="WS2007HttpBinding_ICenterDynamicService"
contract="DBCenterDynamicService.ICenterDynamicService" name="WS2007HttpBinding_ICenterDynamicService">
<identity>
<servicePrincipalName value="host/iZ23joewgpoZ" />
</identity>
</endpoint>
</client>
</system.serviceModel>
ws2007HttpBinding 服务器端
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ESBAPIServiceI" />
</basicHttpBinding>
<ws2007HttpBinding>
<binding name="ws2007HttpBindingServiceBinding" receiveTimeout="00:10:00" sendTimeout ="00:10:00" maxReceivedMessageSize='2147483647' >
<readerQuotas maxDepth='2147483647'
maxStringContentLength='2147483647'
maxArrayLength='2147483647'
maxBytesPerRead='2147483647'
maxNameTableCharCount='2147483647'/>
</binding>
</ws2007HttpBinding>
</bindings>
<client>
<endpoint address="http://xxxxxxxx1/Server/ESBAPIService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ESBAPIServiceI"
contract="ESBAPIService.ESBAPIServiceI" name="BasicHttpBinding_ESBAPIServiceI" />
</client>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息 -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="useWindowsGroupsAuthorization">
<serviceAuthorization principalPermissionMode="UseWindowsGroups"/>
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="DBServices.Services.Activity.CenterDynamicService" behaviorConfiguration="useWindowsGroupsAuthorization">
<endpoint address="" binding="ws2007HttpBinding" bindingConfiguration="ws2007HttpBindingServiceBinding" contract="DBServices.Services.Activity.ICenterDynamicService"/>
</service>
</services>
</system.serviceModel>