none
Setting endpoint address results in "There was no endpoint listening at..."

    Question

  • Hello,

    I have two environments that are the same (.NET 4.0/IIS 7) except for the operating system (2008 vs 2008 R2 I believe), but one is not behaving correctly.  ServiceModelReg was executed in both environments and running the repair option informed us that everything was OK.  Also, endpoints using the webHttpBinding (REST improvements) have the same problem.

    Once the endpoint address is set, communication no longer works with that endpoint:

     

    <endpoint address="foo" binding="basicHttpBinding" contract="IService" />
    

     

    There was no endpoint listening at http://server/service.svc/foo that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
    
    Server stack trace: 
     at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
     at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
     at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
     at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
     at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
     at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    
    Exception rethrown at [0]: 
     at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
     at Contract.DoSomething(String x)
     at ContractClient.DoSomething(String x)
    
    Inner Exception:
    The remote server returned an error: (404) Not Found.
     at System.Net.HttpWebRequest.GetResponse()
     at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

     

    The address for each endpoint is correct on the client side, the same in each environment (minus the machine name).

     

    Any ideas?



    • Edited by Joseph- Thursday, May 12, 2011 5:56 PM
    Wednesday, May 11, 2011 1:21 PM

Answers

  • Fixed.  Somehow the handler mapping for .svc wasn't being added on this particular machine.  Manually added, all is well.

     

     

    • Marked as answer by Joseph- Friday, May 20, 2011 4:07 PM
    Friday, May 20, 2011 4:07 PM

All replies

  • please publish the server config. also configure wcf trace and log and publish what you found:

    http://blogs.msdn.com/b/madhuponduru/archive/2006/05/18/601458.aspx


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Wednesday, May 11, 2011 5:53 PM
  • Thanks for replying, Yaron.

    Nothing shows up in the WCF trace logs when I try to hit the endpoint with a relative address.  My tracing config is:

     

    <system.serviceModel>
    
      <diagnostics>
       <messageLogging
        maxMessagesToLog="30000"
        logEntireMessage="true"
        logMessagesAtServiceLevel="true"
        logMalformedMessages="true"
        logMessagesAtTransportLevel="true">
       </messageLogging>
      </diagnostics>
    
     </system.serviceModel>
    
     <system.diagnostics>
      <sources>
       <source name="System.ServiceModel"
           switchValue="Verbose, ActivityTracing"
           propagateActivity="true" >
        <listeners>
         <add name="xml" />
        </listeners>
       </source>
    
       <source name="System.ServiceModel.MessageLogging"
           switchValue="Verbose">
        <listeners>
         <add name="xml" />
        </listeners>
       </source>
      </sources>
    
      <sharedListeners>
       <add name="xml"
          type="System.Diagnostics.XmlWriterTraceListener"
          initializeData="devlog.svclog" />
      </sharedListeners>
      <trace autoflush="true" />
     </system.diagnostics>
    

    And my service config:

      <services>
       <service name="ServiceName">
        <endpoint address="" binding="basicHttpBinding" contract="IService" />
        <endpoint address="ws" binding="wsHttpBinding" contract="IService" />
        <endpoint address="rest" binding="webHttpBinding" behaviorConfiguration="RESTHelpBehavior" contract="IService" />
       </service>
      </services>
    
       <endpointBehaviors>
        <behavior name="RESTHelpBehavior">
         <webHttp helpEnabled="true" />
        </behavior>
       </endpointBehaviors>
    

    Endpoints with addresses "ws" and "rest" do not work, but the endpoint without an address specified does work.

    Thursday, May 12, 2011 5:07 PM
  • do you deploy on iis?

    what is the client config that calls the /ws endpoint? possibly it is not on the same domain.


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Saturday, May 14, 2011 2:03 PM
  • Yes, I am deploying to IIS 7.

    The client config is OK.  I've tried the various combinations of:

    http://machine.domain.org/Service.svc

    http://machine/Service.svc

    Both work fine when hitting the working environment, but neither choice works when I hit the apparently broken environment.

    Monday, May 16, 2011 1:03 PM
  • Joseph,

    It seems the service config file is not fully pasted. Can you paste the entire service config, I need to see even the host value ..

    Thanks RatZzz

    Monday, May 16, 2011 1:45 PM
  • I don't have a host element within the service element.
    Monday, May 16, 2011 2:32 PM
  • Are you able to get to the service from your browser?
    Monday, May 16, 2011 2:33 PM
  • Yes.
    Monday, May 16, 2011 3:40 PM
  • I'm not sure what is going on but if the problem is caused by the environment we should be able to reproduce the problem with a simple sample, like the Getting Started Tutorial sample. Please try using that code (if you don't have the WCF samples installed you can download them from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=35ec8682-d5fd-4bc3-a51a-d8ad115a8792&displaylang=en) and see if you can reproduce the problem with that simplified scenario. If so then the problem is somewhere in the environment, otherwise the problem must be in the code.  Please let us know what you find.

    Thanks,

    Michael Green
    WCF Documentation Team

    Monday, May 16, 2011 10:47 PM
  • Michael,

    This is definitely an environment issue.  As I suspected, compiling and deploying WF_WCF_Samples\WCF\Basic\Services\MultipleEndpoints\CS\service shows that the endpoint with the relative address of "secure" does not work.  The other endpoint works just fine.

    There was no endpoint listening at http://server.domain.org/wcfsample/service.svc/secure that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
    
    Server stack trace: 
      at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout)
      at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout)
      at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
      at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
      at System.ServiceModel.Security.CommunicationObjectSecurityTokenProvider.Open(TimeSpan timeout)
      at System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout)
      at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
      at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
      at System.ServiceModel.Channels.SecurityChannelFactory`1.ClientSecurityChannel`1.OnOpen(TimeSpan timeout)
      at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
      at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout)
      at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout)
      at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout)
      at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout)
      at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
      at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
      at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
      at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
      at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
      at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
      at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
      at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    
    Exception rethrown at [0]: 
      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
      at ICalculator.Add(Double n1, Double n2)
      at CalculatorClient.Add(Double n1, Double n2)
    
    Inner Exception:
    The remote server returned an error: (404) Not Found.
      at System.Net.HttpWebRequest.GetResponse()
      at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

    Tuesday, May 17, 2011 12:47 PM
  • Soooo.... it's an environment problem.  I believe I've proven that to myself and hopefully you all as well.

    Now, what do I need to do?  Execute ServiceModelReg with some option(s)?  Go as far as to reinstall .NET?  Call Microsoft?

    Wednesday, May 18, 2011 12:23 PM
  • Joseph,

    I'm wondering if this is security related. If you change the secure endpoints settings so that it does not use security, does the problem still occur?

    Thanks,

    Michael Green
    WCF Documentation Team

    Wednesday, May 18, 2011 2:36 PM
  • The same thing occurs with the security mode set to "None".  I'd also like to reiterate that the webHttpBinding also does not work.
    Wednesday, May 18, 2011 4:11 PM
  • Joseph,

    It's interesting that you are getting a different call stack with the Mulitple Endpoints sample. The call on the top of the stack was  "System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout)" which is security related (which is why I brought that up). The original callstack you posted is the exact same callstack you would see if the .svc file could not be found.  But since at least one endpoint works we know that the .svc file is, in fact there and accessable.  Are there other services on the problematic machine that seem to be working? Is the problem confined to a specific website or virtual directory on that machine? One quick and easy thing you can try is to re-register the WCF handler in IIS by running the following command in a command prompt: aspnet_regiis -i

    Is the WCF Routing Service configured on the problematic machine?

    Thanks,

    Michael Green
    WCF Documentation Team

    Wednesday, May 18, 2011 6:23 PM
  • It doesn't matter if security is enabled or disabled.  Flat out, the problem is that if an endpoint has an address it won't work.  It will happen to any service on the machine.  I haven't deployed a service using the new Routing features.

    I'll have my guy re-run the aspnet_regiis -i

     

    Thanks

    Thursday, May 19, 2011 11:10 AM
  • aspnet_regiis -i was run, and it reported that errors were detected but otherwise finished successfully.  The virtual directory that the errors were reported on doesn't concern me, it's not a directory that I publish to.  But I'll list the errors anyways:

    CreateDirectoryInternal failed with HRESULT 80070003: 'The system cannot find the path specified.  '

    CreateSiteClientScriptDir failed with HRESULT 80070003: 'The system cannot find the path specified.  '

    Anyways, the crazy thing is that there are a bunch of entries in the log file like this:

    2011-05-20 08:49:24        Starting    Creating list of client site scripts dirs
    2011-05-20 08:49:24            Starting    Creating directory: E:\webdocs\x\aspnet_client
    2011-05-20 08:49:24            Success     Creating directory: E:\webdocs\x\aspnet_client
    2011-05-20 08:49:24            Starting    Creating directory: E:\webdocs\x\aspnet_client\system_web
    2011-05-20 08:49:24            Success     Creating directory: E:\webdocs\x\aspnet_client\system_web
    2011-05-20 08:49:24            Starting    Creating directory: E:\webdocs\x\aspnet_client\system_web\4_0_30319
    2011-05-20 08:49:24            Success     Creating directory: E:\webdocs\x\aspnet_client\system_web\4_0_30319

    The directory I deploy to, lets call it E:\webdocs\y\, is never listed in the log file.  Curious!

    Here is the output from the command line:

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis -i
    Start installing ASP.NET (4.0.30319).
    ........
    Finished installing ASP.NET (4.0.30319).
    Setup has detected some errors during the operation. For details, please read th
    e setup log file C:\Users\xyz\AppData\Local\Temp\2\ASPNETSetup_00000.log


    Friday, May 20, 2011 1:07 PM
  • Fixed.  Somehow the handler mapping for .svc wasn't being added on this particular machine.  Manually added, all is well.

     

     

    • Marked as answer by Joseph- Friday, May 20, 2011 4:07 PM
    Friday, May 20, 2011 4:07 PM