powered by simpleCommunicator - 2.0.49     © 2025 Programmizd 02
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / Не пролезает файл больше 12 Мб (Maximum request length exceeded)
2 сообщений из 2, страница 1 из 1
Не пролезает файл больше 12 Мб (Maximum request length exceeded)
    #37704631
CmeTanka
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Не получается через wcf сервис отправить файл более 12- 13 мб.

вот код перегруженного метода CreateServiceHost

Код: c#
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
{

 IssuedSecurityTokenParameters itp = new IssuedSecurityTokenParameters(
                   "http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1");

            itp.IssuerAddress = new EndpointAddress(ConfigManager.ActAsSTS);
            itp.IssuerMetadataAddress = new EndpointAddress(ConfigManager.ActAsSTS + "/mex");

            // Create the security binding element
            SecurityBindingElement sbe = SecurityBindingElement.CreateIssuedTokenForCertificateBindingElement(itp);
            sbe.MessageSecurityVersion =
                MessageSecurityVersion.WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10;
            

            // Create the HTTP transport binding element
            HttpTransportBindingElement httpBe = new HttpTransportBindingElement();
           httpBe.MaxReceivedMessageSize = httpBe.MaxBufferPoolSize = Constants.MaxFileSize;


           TextMessageEncodingBindingElement encodingElement = new TextMessageEncodingBindingElement();
            XmlDictionaryReaderQuotas quotas = encodingElement.ReaderQuotas;
            quotas.MaxArrayLength = quotas.MaxBytesPerRead = quotas.MaxStringContentLength = quotas.MaxNameTableCharCount = quotas.MaxDepth = (int)Constants.MaxFileSize;

            // Create the custom binding using the prepared binding elements
            CustomBinding binding = new CustomBinding(sbe, encodingElement, httpBe);


            EndpointAddress endpointAddress = new EndpointAddress(new Uri(ConfigManager.BaseAddress));
            ServiceEndpoint endpoint = new ServiceEndpoint(contractDescription, binding, endpointAddress);
            host.Description.Endpoints.Add(endpoint);

            
            host.Credentials.ServiceCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My,
                X509FindType.FindByThumbprint, ConfigManager.ServiceCertificateThumbprint);
}




Constants.MaxFileSize = 20971520 (т.е. 20 Мб)

Все необходимые настройки, как MaxReceivedMessageSize, MaxBytesPerRead итд вроде как указываю

в конфиге тоже стоит <httpRuntime maxRequestLength="20480"/> (там вроде в килобайтах указывается)

Не пойму в чём затык.
...
Рейтинг: 0 / 0
Не пролезает файл больше 12 Мб (Maximum request length exceeded)
    #37719318
ka3yc
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
CmeTanka, приведите конфиг клиента вашего сервиса
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / Не пролезает файл больше 12 Мб (Maximum request length exceeded)
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]