Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Распределённые приложения и сеть > Максимальный размер квоты


Автор: Moid 13.10.2008, 09:55
Использую такое подключение:
Код

private void openHost()
        {
            string hostAdress = (string)Registry.GetValue(HostService.keyName, HostService.hostAdressKeyName, null);
            svcHost.AddServiceEndpoint(typeof(IHostContract), new NetTcpBinding(SecurityMode.None, true), hostAdress);
            svcHost.Open();
        }


Возникла проблема при передачи файла к серверу. Если передаю файл больше 16кб, то выскакивает ошибка:

The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'ReciveFile'. The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader.


В гугле нарыл, что максимальное значение квоты можно поменять:
Код

<readerQuotas maxArrayLength="10000" />


Как изменить это значение в Windows Forms приложении?

Автор: Moid 13.10.2008, 11:06
Пытался делать так:
Код

string hostAdress = (string)Registry.GetValue(HostService.keyName, HostService.hostAdressKeyName, null);
            NetTcpBinding netTcpBinding = new NetTcpBinding(SecurityMode.None, true);
            netTcpBinding.MaxReceivedMessageSize = 294967296;// 281 mb
        netTcpBinding.MaxBufferSize = 294967296;
        netTcpBinding.ReaderQuotas.MaxArrayLength = 294967296;
        netTcpBinding.ReaderQuotas.MaxBytesPerRead = 294967296;
        netTcpBinding.ReaderQuotas.MaxStringContentLength = 294967296;
            svcHost.AddServiceEndpoint(typeof(IHostContract), netTcpBinding, hostAdress);


Всеравно таже ошибка.

Автор: Moid 13.10.2008, 16:16
Все правильно... последнее помогло... забыл с резил мода переключиться  smile 

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)