0

我已经寻找了几个小时,但没有找到我认为是一个有点普遍的问题的答案。

我有很多数据(字符串 [2000000])我想通过服务引用(asmx)发送到服务。SOAP 由于现在的大小而爆炸,我不想增加管道,因为明天可能要发送 4M 字符串。

所以我在考虑多部分 SOAP 消息,但是 .NET 本身并不支持这个(对吗?)。那么如何去做呢?任何帮助或链接将不胜感激。

[WebMethod]
public string[] returnSameStringArray(string[] string_array)
{
    return string_array;
}

调用代码:

BasicHttpBinding basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
basicHttpBinding.MaxReceivedMessageSize = 131072;

myServiceReference = new MyService.MyServiceSoapClient(basicHttpBinding, new EndpointAddress(@"http://myaddress/myservice.asmx"));
myServiceReference.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
myServiceReference.ChannelFactory.Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;

string[] theStringArray = new string[2000000](); //init with something later
theStringArray = myServiceReference.returnSameStringArray(theStringArray);
4

1 回答 1

0

我建议您查看 zeromq 和服务堆栈。它们为您提供所需的控制量。

您还可以考虑将有效负载拆分为多个调用。

于 2012-01-06T18:55:00.423 回答