Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Exists and partially working but for some calls returns "no endpoint listening - (404) Not Found."

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?

like image 853
veljkoz Avatar asked Jul 14 '11 08:07

veljkoz


2 Answers

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>
like image 155
atconway Avatar answered Sep 20 '22 03:09

atconway


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

like image 24
veljkoz Avatar answered Sep 20 '22 03:09

veljkoz