【发布时间】:2014-05-23 05:00:51
【问题描述】:
我的服务有点问题。它不支持大量数据,我必须为它发送一个用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>
谁能帮帮我?
【问题讨论】:
-
您是否尝试过将文件分成多个块,然后让网络服务将它们重新组合在一起?
-
在您的
<service>上,尝试添加bindingConfiguration="WebHttpEndpointBinding" -
@javisrk,我该怎么做?
-
@kei,试过了,没用
-
stackoverflow.com/questions/7853467/… 有一个使用 HTML5 文件 API 上传块的示例 - 服务器示例是 PHP,但客户端示例是标准 javascript。