.net 未能分配134217728字节的托管内存缓冲区。可用内存量可能较低
我试图通过WCF服务调用将大量数据保存到数据库中。我无法调用该服务。这是一个错误.net 未能分配134217728字节的托管内存缓冲区。可用内存量可能较低,.net,wcf,.net,Wcf,我试图通过WCF服务调用将大量数据保存到数据库中。我无法调用该服务。这是一个错误 codeProxy.SaveCodes(requestHeader, codes, Rawcodes); 未能分配134217728字节的托管内存缓冲区。这个 可用内存量可能较低 我已将服务器端和客户端的web配置配置为最大限制 客户端web.config <binding name="WSHttpBinding_dataService" closeTimeout="00:01:00" openTimeou
codeProxy.SaveCodes(requestHeader, codes, Rawcodes);
未能分配134217728字节的托管内存缓冲区。这个
可用内存量可能较低
我已将服务器端和客户端的web配置配置为最大限制
客户端web.config
<binding name="WSHttpBinding_dataService" closeTimeout="00:01:00" openTimeout="00:01: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="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"/>
</security>
</binding>
<service name="ser.WSHttpBinding_dataService" behaviorConfiguration="ServiceBehavior">
<endpoint contract="ser.IDataservice" binding="wsHttpBinding" bindingConfiguration="datacodeservice" />
</service>
<wsHttpBinding>
<binding name="datacodeservice" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
<security mode ="None">
<!--<message clientCredentialType="Certificate" />-->
</security>
</binding>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
<serviceThrottling maxConcurrentSessions="100" />
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</serviceBehaviors>
服务器web.config
<binding name="WSHttpBinding_dataService" closeTimeout="00:01:00" openTimeout="00:01: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="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"/>
</security>
</binding>
<service name="ser.WSHttpBinding_dataService" behaviorConfiguration="ServiceBehavior">
<endpoint contract="ser.IDataservice" binding="wsHttpBinding" bindingConfiguration="datacodeservice" />
</service>
<wsHttpBinding>
<binding name="datacodeservice" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
<security mode ="None">
<!--<message clientCredentialType="Certificate" />-->
</security>
</binding>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
<serviceThrottling maxConcurrentSessions="100" />
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</serviceBehaviors>
使用WCF操作的消息契约中的流属性来传输大型对象
[MessageContract]
public class DocumentDescription
{
[MessageBodyMember(Namespace = "http://example.com/App")]
public Stream Stream { get; set; }
}
以这种方式配置绑定
<binding name="Binding_DocumentService" receiveTimeout="03:00:00"
sendTimeout="02:00:00" transferMode="Streamed" maxReceivedMessageSize="2000000">
<security mode="Transport" />
</binding>
要将大数据上载到SQL Server数据库,请使用以下文章中描述的方法如果在.Net 2.0服务中遇到此问题,此修补程序可能会有所帮助 问题 运行基于.NET Framework 2.0的应用程序时 应用程序崩溃。如果调试应用程序,您会注意到 引发System.InsufficientMemoryException异常。那么,你 接收类似以下内容的错误消息:未能 分配字节的托管内存缓冲区。可用的数量 内存可能不足 原因 问题1的起因 当应用程序尝试运行时,此问题会间歇性出现 为大型对象堆(LOH)中的大型对象分配内存。这个 当以下条件为真时,将触发错误消息: 堆无法提供足够的内存来满足LOH分配 要求同时正在进行并发垃圾回收 时间问题2的起因 出现此问题的原因是,垃圾收集器的堆平衡非常小 对象分配不会在具有 超过8个逻辑处理器。正因为如此,更多的垃圾 当出现异常时,会触发集合以保持堆平衡 不同处理器中的工作负载不平衡。因此, 应用程序在垃圾收集上花费更多的时间
那么你想发送多少数据呢?我们正在使用wshttpbinding将一组50K记录从表示层传递到WCF服务。