none
Service replies "There was no endpoint listening" and 404 depending on a parameter RRS feed

  • Question

  • I have a service MySaveService.svc that accepts an object to save. The client application has two objects (of the same type) open - ObjectA and ObjectB and it is possible to save each of them separately. When I send ObjectA to the serivice it will save as expected. However, when I send ObjectB to the service it will give me the followind exception message:

    There was no endpoint listening at http://localhost:8020/Services/MySaveService.svcthat could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

    with the inner exception message:

    The remote server returned an error: (404) Not Found.

    again, without restarting the service or client application I send ObjectA to save and it saves ok.

    By the way, I get a proper reply if I go to http://localhost:8020/Services/MySaveService.svc via browser.

    The difference between the two objects is that ObjectB is larger in size, containing more items in collections, compared to ObjectA. However I would expect some kind of exception saying that the size is greater than the limit or similat but not the 404 error.

    Could someone help me with this error. I don't really know where to start with the problem.

    Thanks.

    Tuesday, June 10, 2014 11:10 AM

Answers

  • after a week of searching and experimenting with types, isolating the problem, I found the following solution:

    (credit goes to http://stackoverflow.com/a/6907582/1694087)

    Web.config needed the following:

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

    • Marked as answer by Тridy Thursday, June 26, 2014 8:46 PM
    Thursday, June 26, 2014 8:46 PM

All replies

  • Hi,

    As you said that maybe your objectB'size is greater than the limit and reaches the timeout value, so it throws the 404 error.

    Then please try to increase the size value and the timeout value as following in the both the service and client side:

    <bindings>
      <basicHttpBinding>
        <binding name="MyBasicHttpBinding"
            closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00"
            sendTimeout="00:10:00"  maxBufferSize="2147483647"
            maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
            messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed">
          
          <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647"
              maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"  />
        </binding>
      </basicHttpBinding>
    </bindings>
    
     
       <endpoint address=" "
          binding="basicHttpBinding" bindingConfiguration="MyBasicHttpBinding"
          name="MyBasicHttpBinding" contract="YourServiceContract" />

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, June 11, 2014 2:51 AM
    Moderator
  • I don't think that the size is the problem there. I tried to create an object that is around the same size as ObjectB and it managed to save alright. What is interesting that it shoots back 404 almost right away, so I don't think it is the problem of timeouts. Neither it should be a problem of a size. Here is a part of the client's app.config:

      <system.serviceModel>
        <bindings>
          <wsHttpBinding>
            <binding name="myWSHttpBinding"
                     closeTimeout="00:01:00"
                     openTimeout="00:01:00"
                     receiveTimeout="00:10:00"
                     sendTimeout="00:04:00"
                     bypassProxyOnLocal="true"
                     transactionFlow="false"
                     hostNameComparisonMode="StrongWildcard"
                     maxBufferPoolSize="2147483647"
                     maxReceivedMessageSize="2147483647"
                     messageEncoding="Text"
                     textEncoding="utf-8"
                     useDefaultWebProxy="false"
                     allowCookies="false">
    
              <readerQuotas maxDepth="200"
                            maxStringContentLength="2147483647"
                            maxArrayLength="2147483647"
                            maxBytesPerRead="2147483647"
                            maxNameTableCharCount="2147483647"/>
    
              <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
              <security mode="None">
                <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
                <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="false"/>
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
        <behaviors>
          <endpointBehaviors>
            <behavior name="myEndpointBehavior">
              <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
            </behavior>
          </endpointBehaviors>
        </behaviors>
        <client>
          <endpoint address="http://localhost:8020/Services/mySaveService.svc" bindingConfiguration="myWSHttpBinding" contract="ImySaveService" behaviorConfiguration="myEndpointBehavior" binding="wsHttpBinding" name="mySaveServiceEndPoint"/>
        </client>
      </system.serviceModel>
    At first, I was thinking there could be a problem of KnownTypes for serialization, but that should not fire 404 error, should it?

    Wednesday, June 11, 2014 9:30 AM
  • Does the method saving ObjectB miss OperationContract?
    Wednesday, June 11, 2014 10:46 AM
  • Does the method saving ObjectB miss OperationContract?

    Saving ObjectB calls the same method of the same service as saving ObjectA, so if OperationContract is missing, how would it save ObjectA? But I double checked it and it's there.

    Wednesday, June 11, 2014 11:09 AM
  • Little by little I figured it out that this is a message size problem. I tried to measure the size of the object that we send and it appears that somewhere around 35MB (when serialized to disk). I just kept adding items to a list inside of the object and was sending to WCF Service until I got the exception.

    The thing is that we have set all the size related variables in app.config and web.config to 2GB, so 35MB should not be killing it.

    Am I missing something i web/app.config or setting it wrong?

    web.config

    <?xml version="1.0"?>
    <configuration>
      <system.web>
        <httpRuntime maxRequestLength="2147483647"/>
        <compilation debug="true" targetFramework="4.5.1"/>
        <authentication mode="Windows"/>
        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
        <customErrors mode="Off"/>
      </system.web>
    
      <system.serviceModel>
        
        <bindings>
          
          <wsHttpBinding>
    
            <binding name="myWSHttpBinding"
                     closeTimeout="00:01:00"
                     openTimeout="00:01:00"
                     receiveTimeout="00:10:00"
                     sendTimeout="00:02:00"
                     bypassProxyOnLocal="false"
                     transactionFlow="false"
                     hostNameComparisonMode="StrongWildcard"
                     maxBufferPoolSize="2147483647"
                     maxReceivedMessageSize="2147483647"
                     messageEncoding="Text"
                     textEncoding="utf-8"
                     useDefaultWebProxy="true"
                     allowCookies="false">
    
              <readerQuotas maxDepth="2000000"
                            maxStringContentLength="2147483647"
                            maxArrayLength="2147483647"
                            maxBytesPerRead="2147483647"
                            maxNameTableCharCount="2147483647" />
    
    
              <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
              <security mode="None">
                <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
                <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="false"/>
              </security>
            </binding>
    
          </wsHttpBinding>
        
        </bindings>
        
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
        
        <services>
          <service behaviorConfiguration="Company.SomeService.SearchServiceBehavior" name="Company.SomeDBServer.SomeService.MySearchService">
            <endpoint address="" binding="wsHttpBinding" bindingConfiguration="myWSHttpBinding" contract="Company.SomeDBServer.SomeService.IMySearchService">
              <identity>
                <dns value="localhost"/>
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
          </service>
          <service behaviorConfiguration="Company.SomeDBServer.SomeService.LoadServiceBehavior" name="Company.SomeDBServer.SomeService.MyLoadService">
            <endpoint address="" binding="wsHttpBinding" bindingConfiguration="myWSHttpBinding" contract="Company.SomeDBServer.SomeService.IMyLoadService">
              <identity>
                <dns value="localhost"/>
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
          </service>
          <service behaviorConfiguration="Company.SomeDBServer.SomeService.AdminServiceBehavior" name="Company.SomeDBServer.SomeService.MyAdminService">
            <endpoint address="" binding="wsHttpBinding" bindingConfiguration="myWSHttpBinding" contract="Company.SomeDBServer.SomeService.IMyAdminService">
              <identity>
                <dns value="localhost"/>
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
          </service>
          <service behaviorConfiguration="Company.SomeDBServer.SomeService.SaveServiceBehavior" name="Company.SomeDBServer.SomeService.MySaveService">
            <endpoint address="" binding="wsHttpBinding" bindingConfiguration="myWSHttpBinding" contract="Company.SomeDBServer.SomeService.IMySaveService">
              <identity>
                <dns value="localhost"/>
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
          </service>
        </services>
        
        <behaviors>
          <serviceBehaviors>
            <behavior name="Company.SomeService.SearchServiceBehavior">
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="true"/>
              <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
            </behavior>
            <behavior name="Company.SomeDBServer.SomeService.LoadServiceBehavior">
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="true"/>
              <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
            </behavior>
            <behavior name="Company.SomeDBServer.SomeService.AdminServiceBehavior">
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="true"/>
              <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
            </behavior>
            <behavior name="Company.SomeDBServer.SomeService.SaveServiceBehavior">
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="true"/>
              <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
            </behavior>
            <behavior name="">
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="false"/>
              <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      
      </system.serviceModel>
      
      <system.webServer>
        <defaultDocument enabled="true"/>
        <validation validateIntegratedModeConfiguration="false"/>
      </system.webServer>
    
    </configuration>

    app.config

    <configuration>
        <system.serviceModel>
            <bindings>
              
                <wsHttpBinding>
                  
                    <binding name="MyServiceBinding" 
                     hostNameComparisonMode="StrongWildcard"
                     maxBufferPoolSize="2147483647"
                     maxReceivedMessageSize="2147483647">
                      
                        <security mode="None" />
                      
                    <readerQuotas maxDepth="2147483647"
                            maxStringContentLength="2147483647"
                            maxArrayLength="2147483647"
                            maxBytesPerRead="2147483647"
                            maxNameTableCharCount="2147483647"/>
                
                    </binding>
          
                </wsHttpBinding>
            
            </bindings>
            <client>
              <endpoint address="http://localhost:8020/Services/MySaveService.svc"
                   binding="wsHttpBinding" bindingConfiguration="MyServiceBinding"
                   contract="IMySaveService">
                <identity>
                  <dns value="localhost" />
                </identity>
              </endpoint>
            </client>
        </system.serviceModel>
    </configuration>

    Friday, June 13, 2014 4:35 PM
  • after a week of searching and experimenting with types, isolating the problem, I found the following solution:

    (credit goes to http://stackoverflow.com/a/6907582/1694087)

    Web.config needed the following:

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

    • Marked as answer by Тridy Thursday, June 26, 2014 8:46 PM
    Thursday, June 26, 2014 8:46 PM