gpt4 book ai didi

wcf - IIS 7.5 托管的 WCF 服务仅针对大型请求抛出 EndpointNotFoundException 和 404

转载 作者:行者123 更新时间:2023-12-02 13:32:35 26 4
gpt4 key购买 nike

我有一个在 IIS 7.5 Windows 2008 R2 上托管的 WCF REST 服务。该服务按预期工作,除非客户端尝试发送大于 ~ 25 MB 的消息。具体来说,当发送大小约为 25 MB 的消息时,服务会正确接收并处理消息,而当发送大小约为 31 MB 的消息时,服务会失败。

当在 VS 2010 本地托管时,接收消息时不会出现错误。当远程托管在 IIS 7.5 上时,服务立即响应:“System.ServiceModel.EndpointNotFoundException:没有端点正在监听...”,内部异常是:“远程服务器返回错误:(404) 未找到” 。

这与最大消息大小设置不足时引发的异常不同。鉴于在本地托管时我没有收到错误,我的猜测是它与 IIS 或某些防火墙设置有关。

这是配置:

  <system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime requestPathInvalidCharacters="" maxRequestLength="512000"/>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"/>
<bindings>
<webHttpBinding>
<binding maxReceivedMessageSize="524288000" maxBufferSize="524288000">
<readerQuotas maxStringContentLength="524288000" maxArrayLength="524288000"/>
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>

最佳答案

让你烦恼的是 IIS 的最大上传大小。它的默认值为 30MB。您可以在 web.config 中修复它:

<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="524288000"/>
</requestFiltering>
</security>
</system.webServer>

您还可以在 IIS 管理器中的请求过滤/功能设置中的某个位置进行更改。要修复的值为“允许的最大内容长度(字节)”。

关于wcf - IIS 7.5 托管的 WCF 服务仅针对大型请求抛出 EndpointNotFoundException 和 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6737065/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com