У меня есть приложение веб-форм asp и служба wcf, как localhost. Это конфиг из веб-приложенияC# WCF localhost Удаленный сервер возвратил неожиданный ответ: (413) Request Entity Too Large
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="200" maxStringContentLength="8388608" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:63251/Poruka.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService" contract="localhostPoruka.IPoruka" name="BasicHttp_IService"/>
</client>
Это веб-конфигурации из службы WCF
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" openTimeout="00:20:00"
receiveTimeout="00:20:00" closeTimeout="00:20:00" sendTimeout="00:20:00">
<readerQuotas maxDepth="200" maxStringContentLength="8388608" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="16384" />
<security mode="Transport"/>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="MyServiceName">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService"
contract="localhostPoruka.IPoruka"
name="BasicHttp_IService"/>
</service>
</services>
Загрузить работы для файлов меньшего размера (например, 30kb), но когда я попробовал что-то большее (размер pdf 80kb), я получил слишком большую ошибку 413 Entity. Я пробовал добавить messageSize на клиента и службу, но это не помогает. Я также addded в applicationHost файл эти строки
<location path="localhost">
<system.webServer>
<serverRuntime uploadReadAheadSize="2147483647" />
</system.webServer>
</location>
Я также попытался в диспетчере IIS по умолчанию веб-сайт-> конфигурации editor-> system.webServer/выполнения набора UploadReadAheadSize. Ничего из этого не помогло. Что-то не так в моем файле конфигурации или я должен установить другое свойство где-то еще? Должен ли я попытаться использовать wsHttpBinding?
Можете ли вы обновить свой вопрос с помощью полного раздела вашего wcf-сервиса web.config? –
Marc
В конфигурационном файле службы попробуйте удалить имя привязки «BasicHttpBinding_IService», если вы не объявите конечную точку в узле служб. –
Я редактировал оба файла конфигурации – Error