WCF 存在并且部分工作,但对于某些调用返回“无端点侦听 - (404) 未找到”。

发布于 2024-11-23 20:38:12 字数 1576 浏览 4 评论 0原文

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

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

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

我已经在网络中打开了跟踪(system.diagnostics) .config 并在 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 和其他属性的限制内。

目前我对消息的大小表示怀疑,但无法确定 - 您知道如何进一步调试吗?

We have service that's working with small to large sets of data (document generation), and it's working fine for some calls, but for some specific requests (exact same method, different arguments) it just returns:

System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://localhost:8010/MyService/MyService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: The remote server returned an error: (404) Not Found.

Note that the service is working, documents are generated but as I said not all of them... (and service can be opened from browser)

I've turned on tracing (system.diagnostics) in web.config and got no further info in the svclog.

The binding (wsHttp) is configured as:

    <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>

and also, there's:

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

I believe the message should fall within limits of maxReceivedMessageSize, and other attributes.

Currently I'm suspicious of the size of the message, but just cannot be sure - do you have any idea how can I debug this further?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

眼角的笑意。 2024-11-30 20:38:12

我使用 在 IIS 7 中使用跟踪对失败的请求进行故障排除(非常酷的东西顺便说一句)

在那里,我看到错误实际上是404.13,这很容易让我发现真正的错误:内容长度太大

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

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

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

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

I found what was wrong using instructions on Troubleshooting Failed Requests Using Tracing in IIS 7 (very cool stuff btw)

There, I saw that the error was in fact the 404.13, which easily led me to what's really wrong: Content length too large.

In the end, the solution was to add this to web config:

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

and, also, make sure that the default web site doesn't override it using:

"%WINDIR%\System32\inetsrv\appcmd.exe" list config "Default web site" -section:requestFiltering

默嘫て 2024-11-30 20:38:12

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

<system.web>
  <!--Increase 'maxRequestLength' to needed value: 100mb (value is in kilobytes)-->
  <httpRuntime maxRequestLength="102400"/>
</system.web>

I found in addition to maxAllowedContentLength, the maxRequestLength on the server side in your WCF confgiration needs to be increased as well. I found that both values had to be increased for the exception to be resolved. In the .config for the WCF service server side make sure to add the following:

<system.web>
  <!--Increase 'maxRequestLength' to needed value: 100mb (value is in kilobytes)-->
  <httpRuntime maxRequestLength="102400"/>
</system.web>
走野 2024-11-30 20:38:12

如果您对消息的内容和/或长度有疑问,您可以尝试使用 Fiddler 等拦截调用 -这应该会让你在这些问题上放心。

If you are suspicious about the content and/or length of the message, you can try to intercept the calls using something like Fiddler - that should set your mind at ease on those points.

酸甜透明夹心 2024-11-30 20:38:12

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

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

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

Check the name attribute of the service element in the web.config:

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

The service name should contain the correct namespace+classname.
You can find this in de code or by looking in the markup of the .svc file (or open the .svc file with notepad) for the Service="..." attribute.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文