Performance 提高WCF性能
我们已经为我们的移动应用程序设计了AJAX–支持WCF web服务。Web服务方法以JSON格式返回数据。我们正在观察调用web服务并将其绑定到移动小部件的延迟。数据大小约为50K 根据,我们已将更改应用于WCF web服务的web.config文件 类似地,在stackoverflow事件之后,我们试图增加消息大小。现在,问题是我们应该如何将更改应用到当前的web.config文件中,以便增加消息大小。我们使用默认的NET4.0设置。此外,我们是否需要在客户端web.config文件上定义端点。有人能提供客户端web.config吗 我们当前的服务器web.config设置为:Performance 提高WCF性能,performance,wcf,wcf-binding,Performance,Wcf,Wcf Binding,我们已经为我们的移动应用程序设计了AJAX–支持WCF web服务。Web服务方法以JSON格式返回数据。我们正在观察调用web服务并将其绑定到移动小部件的延迟。数据大小约为50K 根据,我们已将更改应用于WCF web服务的web.config文件 类似地,在stackoverflow事件之后,我们试图增加消息大小。现在,问题是我们应该如何将更改应用到当前的web.config文件中,以便增加消息大小。我们使用默认的NET4.0设置。此外,我们是否需要在客户端web.config文件上定义端点
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<identity impersonate="false" />
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
<system.serviceModel>
<diagnostics performanceCounters="All"></diagnostics>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<!--Increase WCF Performance-->
<serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="MobileService.webHttpBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<!--Increase WCF Performance-->
<bindings>
<basicHttpBinding>
<binding name="basicHttp" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000">
<readerQuotas maxDepth="32" maxArrayLength="20000000" maxStringContentLength="20000000"/>
</binding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="MobileWCFService.Service1" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="webHttpBinding" contract="MobileWCFService.Service1" behaviorConfiguration="MobileService.webHttpBehavior" />
</service>
</services>
</system.serviceModel>
</configuration>
有人能确认我应用的更改是否有效,并将其标记为确认答案吗
<system.serviceModel>
<diagnostics performanceCounters="All"></diagnostics>
<behaviors>
<endpointBehaviors>
<behavior name="MobileService.webHttpBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<!--Increase WCF Performance-->
<serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100"/>
</behavior>
</serviceBehaviors>
</behaviors>
<!--Increase WCF Performance-->
<bindings>
<webHttpBinding>
<binding name="webHttp" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000">
<readerQuotas maxDepth="32" maxArrayLength="20000000" maxStringContentLength="20000000"/>
</binding>
</webHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="MobileWCFService.Service1" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="webHttpBinding" contract="MobileWCFService.Service1" behaviorConfiguration="MobileService.webHttpBehavior" bindingConfiguration="webHttp" />
</service>
</services>
为什么要定义
basicHttpBinding
?除非您公开SOAP端点,否则不会使用它(并且无论您指定的设置如何,都不会使用,因为它既没有设置为默认绑定,也没有分配给特定端点)。如果您需要增加webHttpBinding
的最大消息大小,请为该方案创建默认绑定,或定义绑定并通过bindingConfiguration
属性将其分配给端点。@Tim您是否可以提供解释代码,请。另外,我是否也需要在客户端应用类似的web.config。谢谢你的回复。@Tim你能回复你的评论吗。