Исключение при попытке загрузить файлы большого размера - PullRequest
2 голосов
/ 17 июня 2011

Я использую wshttpbinding для своего сервиса

<wsHttpBinding>
            <binding name="wsHttpBinding_Windows" maxBufferPoolSize="9223372036854775807" maxReceivedMessageSize="2147483647">
                <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxStringContentLength="2147483647" maxNameTableCharCount="2147483647"/>
                <security mode="Message">
                    <message clientCredentialType="Windows"/>
                </security>
            </binding>
        </wsHttpBinding>

<behavior name="ServiceBehavior">
                <dataContractSerializer  maxItemsInObjectGraph="6553600"/>
                <serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentInstances="2147483647" maxConcurrentSessions="2147483647"/>
            </behavior>

и когда я пытаюсь загрузить файл размером 15 МБ, выдается исключение EndPointNotFoundException ниже:

Сообщение об исключении:

There was no endpoint listening at "MY SERVICE URL" that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

Исключение:

The remote server returned an error: (404) Not Found.

Ответы [ 2 ]

15 голосов
/ 13 ноября 2012

Есть (2) настройки maxRequestLength и maxAllowedContentLength на стороне сервера в вашей конфигурации WCF, которые вам нужно будет увеличить, чтобы разрешить это исключение. В .config для серверной части службы WCF обязательно добавьте следующее:

<system.web>
  <!--Increase 'maxRequestLength' to needed value: 100mb (value is in kilobytes)-->
  <httpRuntime maxRequestLength="102400"/>
</system.web>

<system.webServer>
  <security>
    <requestFiltering>
      <!--Increase 'maxAllowedContentLength' to needed value: 100mb (value is in bytes)-->
      <requestLimits maxAllowedContentLength="104857600" />
    </requestFiltering>
  </security>
</system.webServer>
1 голос
/ 17 июня 2011

Предел загрузки установлен на 2-м уровне, 1-е - приложением, а 2-е - сервером.

Мне подходит ваша конфигурация приложения.

Проверьте настройки IIS, определенные в вашемфайл machine.config.Я нашел статью Microsoft KB , чтобы настроить

. Вы можете настроить значение в любом из этих мест.

...