0

我正在使用 SL 5 和 WCF DS 5。我正在调用服务 POST 操作,其中将字符串作为输入发送,该输入基本上是文本文件的内容。似乎当字符串较小时,它可以工作,但是当它大约为 1.4KB(文本文件的大小)时,会引发此错误:

{System.InvalidOperationException: An error occurred while processing this request. ---> System.Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.

在 System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 在 System.Data.Services.Http.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 在 System.Data.Services.Client.HttpWebRequestMessage.EndGetResponse(IAsyncResult asyncResult) 在 System.Data .Services.Client.HttpTransportLayer.EndGetResponse(IODataRequestMessage requestMessage, IAsyncResult asyncResult) 在 System.Data.Services.Client.DataServiceContext.GetResponseHelper(ODataRequestMessageWrapper 请求, IAsyncResult asyncResult, Boolean handleWebException) 在 System.Data.Services.Client.QueryResult.AsyncEndGetResponse( IAsyncResult asyncResult) --- 内部异常堆栈跟踪结束 --- 在 System.Data.Services.Client 的 System.Data.Services.Client.BaseAsyncResult.EndExecute[T](Object source, String method, IAsyncResult asyncResult)。System.Data.Services 中的 QueryResult.EndExecuteQuery[TElement](对象源,字符串方法,IAsyncResult asyncResult)。Data.Services 中的Client.DataServiceRequest.EndExecute[TElement](对象源,DataServiceContext 上下文,字符串方法,IAsyncResult asyncResult) .Client.DataServiceContext.EndExecute[TElement](IAsyncResult asyncResult)

我从 WPF 应用程序调用了相同的操作,它工作正常。我也在 WCF DS 主机上这样做了:

WebHttpBinding binding = new WebHttpBinding();
        binding.MaxReceivedMessageSize = int.MaxValue;
        binding.MaxBufferPoolSize = int.MaxValue;
        binding.MaxBufferSize = int.MaxValue;
        binding.ReaderQuotas.MaxStringContentLength = int.MaxValue;

这是来自 SL 客户的电话:

CodeFirstContainer context;

        context = new CodeFirstContainer(new Uri("http://localhost:4444/MyDataService/"));

        OperationParameter p = new UriOperationParameter("fileIDN", fileIDN);
        OperationParameter p1 = new UriOperationParameter("**fileContent**", responseContent);

        context.BeginExecute<int>
            (new Uri(context.BaseUri.OriginalString + "ProcessTextFile"),
                (r) =>
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        try
                        {
                            context = r.AsyncState as CodeFirstContainer;

                            // Get the response of the query.
                            var response = context.EndExecute<int>(r).ToList();
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    );
                },
                context, "POST", true, new OperationParameter[] { p, p1 }
            );
4

1 回答 1

0

我在这里得到了我的问题的答案:

http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/thread/1b9b84cb-916f-4611-a710-dec94ff103ad

于 2012-11-29T21:11:11.697 回答