wsdl文字列パスで任意のWebサービスを呼び出すために、dynamicproxyfactoryを使用します。残念ながら、Webサービスが大量のデータに応答すると、例外が発生します。
System.ServiceModel.CommunicationException:Lequotadetaillemaximaleautoriséepourlesmessagesentrants(65536)aétédépassé。オーグメンタールクォータ、utilisezlapropriétéMaxReceivedMessageSizesurl'élémentdelaliaisonappropriéeを注ぎます。---> System.ServiceModel.QuotaExceededException:Lequotadetaillemaximaleautoriséepourlesmessagesentrants(65536)aétédépassé。オーグメンタールクォータ、utilisezlapropriétéMaxReceivedMessageSizesurl'élémentdelaliaisonappropriéeを注ぎます。--- Fin de la trace de la tile d'exception interne ---
サーバースタックトレース:àSystem.ServiceModel.Channels.HttpInput.ThrowMaxReceivedMessageSizeExceeded()àSystem.ServiceModel.Channels.HttpInput.GetMessageBuffer()àSystem.ServiceModel.Channels.HttpInput.ReadBufferedMessage(Stream inputStream)àSystem.ServiceModel.Channels.HttpInput .ParseIncomingMessage(Exception&requestException)àSystem.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpantimeout)àSystem.ServiceModel.Channels.RequestChannel.Request(メッセージメッセージ、TimeSpanタイムアウト)àSystem.ServiceModel.Dispatcher.RequestChannelBinder。 Request(メッセージメッセージ、TimeSpanタイムアウト)àSystem.ServiceModel.Channels.ServiceChannel.Call(String action、Boolean oneway、ProxyOperationRuntime operation、Object [] ins、Object [] outs、TimeSpanタイムアウト)àSystem.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall、ProxyOperationRuntime操作)àSystem.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessageメッセージ)
[0]で再スローされた例外:àSystem.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg、IMessage retMsg)àSystem.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData、Int32 type)àIWS_MG.ProceedOperation String xmlIn)àWS_MGClient.ProceedOperation(String xmlIn)}
この例外は、maxsizeが65536であり、受信したデータサイズが大きいことを意味します。
maxsizeを変更する方法を知っている人はいますか?
参考までに、これは私のコードです:
try
{
// Factory Creation with WCF WSDL address
DynamicProxyFactory factory = new DynamicProxyFactory(sServiceWsdl);
// Solution test which doesn't work
foreach (ServiceEndpoint endpoint in factory.Endpoints)
{
Binding binding = endpoint.Binding;
XmlDictionaryReaderQuotas myReaderQuotas = new XmlDictionaryReaderQuotas();
myReaderQuotas.MaxStringContentLength = int.MaxValue;
myReaderQuotas.MaxArrayLength = int.MaxValue;
myReaderQuotas.MaxBytesPerRead = int.MaxValue;
myReaderQuotas.MaxDepth = int.MaxValue;
myReaderQuotas.MaxNameTableCharCount = int.MaxValue;
binding.GetType().GetProperty("ReaderQuotas").SetValue(binding, myReaderQuotas, null);
}
// Proxy Creation with Contract's name
DynamicProxy proxy = factory.CreateProxy(sContract);
XElement XmlIN = XElement.Parse(sXmlIN);
// Method call with parameters
XElement XmlOUT = XElement.Parse((string)proxy.CallMethod(sMethod, XmlIN.ToString()));
sXmlOUT = XmlOUT.ToString(SaveOptions.None);
proxy.Close();
}
catch (Exception e)
{
sXmlOUT = new XElement("ALL_XML_OUT", new XElement("APP_TRX", sAppTrx), new XElement("WS_RC", 1), new XElement("ERROR_MESS", e.Message)).ToString(SaveOptions.None);
}