当参数超过一定(小)数量时服务调用失败
我的 Silverlight 应用程序中有一个 Web 服务调用,当参数中的项目数约为 2500 时,该调用失败。有人知道发生了什么事吗?
该参数被声明为一个可观察的集合:
var pointIds = new System.Collections.ObjectModel.ObservableCollection<int>();
我这样称呼它:
client.ServiceClient.MarkAllPointAsFavouriteAsync(Settings.Current.User.UserId,pointIds);
服务调用的定义如下:
public void MarkAllPointAsFavourite(Guid userId, List<int> pointIds)
{
PointRepository.MarkAllPointAsFavourite(userId, pointIds);
}
为什么在使用大约 2500 个整数的列表进行调用时会失败?
给出的错误是:
System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__1(Object sendState)
--- End of inner exception stack trace ---
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
--- End of inner exception stack trace ---
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at Conwx.Net.Client.Framework.CustomerServiceReference.CustomerServiceClient.CustomerServiceClientChannel.EndMarkAllPointAsFavourite(IAsyncResult result)
at Conwx.Net.Client.Framework.CustomerServiceReference.CustomerServiceClient.Conwx.Net.Client.Framework.CustomerServiceReference.ICustomerService.EndMarkAllPointAsFavourite(IAsyncResult result)
at Conwx.Net.Client.Framework.CustomerServiceReference.CustomerServiceClient.OnEndMarkAllPointAsFavourite(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)}
I have a Webservice call in my Silverlight application, which fails when the number of items in the parameter is at about 2500. Anybody knows what is going on?
The argument is declared as an observable collection:
var pointIds = new System.Collections.ObjectModel.ObservableCollection<int>();
I call it like this:
client.ServiceClient.MarkAllPointAsFavouriteAsync(Settings.Current.User.UserId,pointIds);
and the servicecall is defined like this:
public void MarkAllPointAsFavourite(Guid userId, List<int> pointIds)
{
PointRepository.MarkAllPointAsFavourite(userId, pointIds);
}
Why does it fail when calling with a list of approximately 2500 integers?
The error given is:
System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__1(Object sendState)
--- End of inner exception stack trace ---
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
--- End of inner exception stack trace ---
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at Conwx.Net.Client.Framework.CustomerServiceReference.CustomerServiceClient.CustomerServiceClientChannel.EndMarkAllPointAsFavourite(IAsyncResult result)
at Conwx.Net.Client.Framework.CustomerServiceReference.CustomerServiceClient.Conwx.Net.Client.Framework.CustomerServiceReference.ICustomerService.EndMarkAllPointAsFavourite(IAsyncResult result)
at Conwx.Net.Client.Framework.CustomerServiceReference.CustomerServiceClient.OnEndMarkAllPointAsFavourite(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现它在列表中大约有 2100 个项目时失败。这是因为它正在构建一个查询。
在这种情况下,由于您没有返回任何内容,因此您可以通过将定义更改为可调用该方法:
这回避了限制。
您还必须稍微修改调用代码。
I've found it fails at about 2100 items in a list. This is because it's building a query.
In this case as you're not returning anything you could make the method invokable by changing the definition to:
This sidesteps the restriction.
You will have to modify the calling code slightly too.