gpt4 book ai didi

c# - 实体太大错误

转载 作者:太空宇宙 更新时间:2023-11-03 13:24:16 24 4
gpt4 key购买 nike

我的服务有点问题。它不支持大量数据,我必须为它发送一个 base64 编码的图像。服务配置是这样的:

[OperationContract]
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "create", BodyStyle = WebMessageBodyStyle.Bare)]
WSResult<WebService.Model.Order> create(WSOrderCreateParams paramsData);

并且 web.config 具有以下配置:

<system.web>
<compilation targetFramework="4.5" debug="true" />
<httpRuntime targetFramework="4.5" maxRequestLength="1000000000"/>
<system.web>
...
<service.serviceModel>
...
<webHttpBinding>
<binding name="WebHttpEndpointBinding"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows"/>
</security>
</binding>
</webHttpBinding>
...
</service.serviceModel>
...
<services>
<service name="WebService.ws.Order">
<endpoint address="" behaviorConfiguration="Web" binding="webHttpBinding" contract="WebService.ws.IOrder"/>
</service>
</services>

谁能帮帮我?

最佳答案

我已经通过网络配置解决了它。这就是 Web.config 现在的样子:

<system.web>
<compilation targetFramework="4.5" debug="true" />
<httpRuntime targetFramework="4.5" maxRequestLength="1000000000"/>
<system.web>
...
<service.serviceModel>
...
<webHttpBinding>
<binding name="WebHttpEndpointBinding"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows"/>
</security>
</binding>
</webHttpBinding>
...
</service.serviceModel>
...
<services>
<service name="WebService.ws.Order">
<endpoint address="" bindingConfiguration="WebHttpEndpointBinding" behaviorConfiguration="Web" binding="webHttpBinding" contract="WebService.ws.IOrder"/>
</service>
</services>
...
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
<serverRuntime uploadReadAheadSize="2147483647" />
</system.webServer>

我已经在服务中添加了 bindingConfiguration,就像@kei 说的那样,并且

<serverRuntime uploadReadAheadSize="2147483647" /> 

在 system.webServer。 IIS 的默认池不允许您使用 uploadReadAheadSize,因此您必须继续:IIS 管理器 > 配置编辑器 > 部分:system.webServer/serverRuntime > 解锁部分。这样做,它应该工作:)

关于c# - 实体太大错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22971930/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com