提问人:ilikecheese 提问时间:11/8/2023 更新时间:11/8/2023 访问量:12
部署到服务器时无法识别 WCF maxReceivedMessageSize
WCF maxReceivedMessageSize not recognized when deployed to server
问:
我有一个接收 XML 文件的 WCF 服务,但当文件大于服务器上默认的 64KB 时,响应“HTTP/1.1 413 Request Entity Too Large”。
在本地运行,它通过添加值来接受大文件,但在部署到服务器时不会使用这些属性。maxReceivedMessageSize
basicHttpBinding
它是运行 IIS 10 的 2022 年服务器,项目使用的是 .NET 4.7.2
我尝试从我在网上找到的示例中向 web.config 文件添加更多配置,包括 services 和 和 :<service>
<endpoint>
<system.serviceModel>
<services>
<service name="ServiceNamespace.IService">
<endpoint binding="basicHttpBinding"
bindingConfiguration="default"
contract="ServiceNamespace.IService"/>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding maxReceivedMessageSize="1000000"
maxBufferSize="1000000"
maxBufferPoolSize="1000000">
<readerQuotas maxDepth="32" maxStringContentLength="2000001"
maxArrayLength="2000001" maxBytesPerRead="2000001" maxNameTableCharCount="2000001" />
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
<add binding="basicHttpBinding" scheme="http" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
实际上,我只需要大约 3KB,但已将其提高到 1MB,希望它能正常工作。maxReceivedMessageSize
答: 暂无答案
评论