Link to home
Start Free TrialLog in
Avatar of MrAgile
MrAgileFlag for Australia

asked on

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


Hi There,

I'm trying to connect to a service that resides on a remote machine. I have added the service reference and then edited the configuration file using the WCF config editor. I keep getting the following error: {"There was no endpoint listening at http://myip/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."} The inner exception is :The remote server returned an error: (404) Not Found.

I have verfied that the service works, shows metadata etc as i'm calling it from some AJAX methods on the same machine as the service resides.

Sean
code that i'm using to call the service
 
 
!------------------------------------------------------------------
 
 using (Service.ServiceClient serv = new ServiceClient())
                {
 
                 
                        bool result = serv.mywebservicemethod();
}
 
config file from the website i'm trying to call from
 
!--------------------------------------------------------------------------
 
 
<system.serviceModel>
    <client>
      <endpoint address="http://myip/myservice.svc" binding="basicHttpBinding"
        bindingConfiguration="basicHttp" contract="Service.IService"
        name="client" />
    </client>
    <bindings>
      <basicHttpBinding>
        <binding name="basicHttp" />
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="Service.Service">
        <endpoint address="http://myip/myservice.svc" binding="basicHttpBinding"
          bindingConfiguration="basicHttp" name="myendpoint" contract="Service.IService"/>
      </service>
    </services>
  </system.serviceModel>
 
 
 
 
 
web config file from remote server
 
!--------------------------------------------------------------------------
 
<system.serviceModel>
    <diagnostics wmiProviderEnabled="true">
      <messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
    </diagnostics>
    <bindings/>
    <client/>
    <behaviors>
      <endpointBehaviors>
        <behavior name="Myservice.Behavior">
          <enableWebScript/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="metadataSupport">
          <serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
 
 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <services>
      <service name="Service.Service" behaviorConfiguration="metadataSupport">
        <endpoint address="http://myip/myservice.svc" behaviorConfiguration="Myservice.Behavior"
         binding="webHttpBinding" name="myendpoint" contract="Service.IService" />
      </service>
    </services>
  </system.serviceModel>

Open in new window

Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

404 is definitely page can't be found.

Can you type the  http://myip/myservice.svc into IE and get a response?  Can you pull a simple function and retrieve data once you have this page up?

I'm assuming the .svc is a regular .asmx page?

 
Avatar of MrAgile

ASKER

HI There,

when I type the address into IE I get endpoint not found. I do have an endpoint defined or at least I thought so.
 <diagnostics wmiProviderEnabled="true">
      <messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
    </diagnostics>
    <bindings/>
    <client/>
    <behaviors>
      <endpointBehaviors>
        <behavior name="Myservice.Behavior">
          <enableWebScript/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="metadataSupport">
          <serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
 
 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <services>
      <service name="Service.Service" behaviorConfiguration="metadataSupport">
        <endpoint address="http://myip/myservice.svc" behaviorConfiguration="Myservice.Behavior"
         binding="webHttpBinding" name="myendpoint" contract="Service.IService" />
      </service>
    </services>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of ydramu
ydramu
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial