WCF存在并且部分工作但是对于某些调用返回"没有端点侦听 - (404)未找到".

vel*_*koz 12 c# wcf mtom .net-4.0 http-status-code-404

我们的服务使用从小到大的数据集(文档生成),并且它适用于某些调用,但对于某些特定请求(完全相同的方法,不同的参数),它只返回:

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

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

我已经在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>
Run Code Online (Sandbox Code Playgroud)

而且,还有:

<configuration>
  <system.web>
    <httpRuntime maxRequestLength="124288000" />
  </system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)

我相信这个消息应该在maxReceivedMessageSize其他属性的范围内.

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

vel*_*koz 22

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

在那里,我看到错误实际上是404.13,这很容易让我知道错误:内容长度太大.

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

<configuration>
...
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="204800000" />
      </requestFiltering>
    </security>
  </system.webServer>  
</configuration>
Run Code Online (Sandbox Code Playgroud)

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

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