13

我们的服务可以处理从小到大的数据集(文档生成),它对某些调用运行良好,但对于某些特定请求(完全相同的方法,不同的参数)它只返回:

System.ServiceModel.EndpointNotFoundException:在http://localhost:8010/MyService/MyService.svc上没有可以接受消息的端点侦听。这通常是由不正确的地址或 SOAP 操作引起的。有关更多详细信息,请参阅 InnerException(如果存在)。---> System.Net.WebException:远程服务器返回错误:(404)未找到。

请注意,该服务正在运行,文档已生成,但正如我所说,并非所有文档...(并且可以从浏览器打开服务)

我在 web.config 中打开了跟踪(system.diagnostics),但在 svclog 中没有进一步的信息。

绑定(wsHttp)配置为:

    <binding name="wsHttpWithTrans" transactionFlow="True" messageEncoding="Mtom"  maxReceivedMessageSize="65536000" maxBufferPoolSize="124288000">
      <readerQuotas maxDepth="32" maxStringContentLength="819200" maxArrayLength="16384000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
        <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" />
      </security>
    </binding>

而且,还有:

<configuration>
  <system.web>
    <httpRuntime maxRequestLength="124288000" />
  </system.web>
</configuration>

我相信消息应该在maxReceivedMessageSize, 和其他属性的范围内。

目前我对消息的大小持怀疑态度,但不能确定 - 你知道如何进一步调试吗?

4

4 回答 4

22

我使用有关在 IIS 7 中使用跟踪对失败的请求进行故障排除的说明发现出了什么问题(顺便说一句,非常酷的东西)

在那里,我看到错误实际上是404.13,这很容易让我发现真正的错误:Content length too large

最后,解决方案是将其添加到网络配置中:

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

并且,还要确保默认网站不会使用以下方法覆盖它:

“%WINDIR%\System32\inetsrv\appcmd.exe”列表配置“默认网站”-section:requestFiltering

于 2011-07-21T08:15:37.887 回答
4

我发现除此之外maxAllowedContentLengthmaxRequestLength您的 WCF 配置中的服务器端也需要增加。我发现必须增加这两个值才能解决异常。在 WCF 服务服务器端的 .config 中,确保添加以下内容:

<system.web>
  <!--Increase 'maxRequestLength' to needed value: 100mb (value is in kilobytes)-->
  <httpRuntime maxRequestLength="102400"/>
</system.web>
于 2012-11-13T13:51:07.213 回答
0

如果您对消息的内容和/或长度持怀疑态度,您可以尝试使用Fiddler之类的工具拦截呼叫- 这应该让您在这些方面放心。

于 2011-07-14T08:36:47.120 回答
0

检查 web.config 中 service 元素的 name 属性:

<configuration>
    <system.serviceModel>
        <services>
            <service name="...">

服务名称应包含正确的命名空间+类名。您可以在 de 代码中或通过查看 .svc 文件的标记(或使用记事本打开 .svc 文件)中的 Service=".​​.." 属性来找到它。

于 2016-02-08T13:28:47.423 回答