Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

hi all
There was no endpoint listening at http://localhost/Server/GreetingService that could accept the message. This is often caused by an incorrect address or SOAP action

this error pop up to me when i tried to run the mobile application client of wcf service

I made all requirement :
1- service ( greeting service )
this is the code in app.config

<pre lang="xml"><system.serviceModel>
    <bindings />
    <client>
      <endpoint binding="basicHttpBinding" contract="Server.IGreetingService" />
    </client>
    <services>
      <service behaviorConfiguration="Server.Service1Behavior" name="Server.Greeting_Service">
        <endpoint address="GreetingService" binding="basicHttpBinding"
          bindingConfiguration="" contract="Server.IGreetingService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/Server/Service1/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Server.Service1Behavior">
          <!-- To avoid disclosing metadata information,
          set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="True"/>
          <!-- To receive exception details in faults for debugging purposes,
          set the value below to true.  Set to false before deployment
          to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>




2- i created website to host service

this is the code in web.conf
<pre lang="xml">system.serviceModel>
        <services>
            <service behaviorConfiguration="ServiceBehavior" name="Server.Greeting_Service">
                <endpoint address="" binding="basicHttpBinding" bindingConfiguration="" contract="Server.IGreetingService">
                    <identity>
                        <dns value="localhost"/>
                    </identity>
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="ServiceBehavior">
                    <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                    <serviceMetadata httpGetEnabled="true"/>
                    <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
                    <serviceDebug includeExceptionDetailInFaults="false"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
    <system.codedom>
    </system.codedom>
    <system.web>
        <compilation debug="true">
        </compilation>


3- i host the website of service on IIS
and this is the the url of service :
http://localhost/websitewcf/Greeting.svc[^]

4- genrate the code for proxy by powertoys
by the url for the service hosted in IIS

5- put this code in my form

System.ServiceModel.Channels.Binding binding = GreetingServiceClient.CreateDefaultBinding();
            string address = GreetingServiceClient.EndpointAddress.Uri.ToString();
            GreetingServiceClient m_proxy = new GreetingServiceClient(binding, new EndpointAddress(address));
            string result = m_proxy.Greet(textBox1.Text).ToString();
            textBox2.Text = result;      


and when i try to run the mobile app this error is appear

There was no endpoint listening at http://localhost/Server/GreetingService that could accept the message. This is often caused by an incorrect address or SOAP action
Posted

Correct the endpoint. If you have hosted your service on a computer, put the computer's name in stead of localhost and the service should work.
 
Share this answer
 
Correct the endpoint. If you have hosted your service on a computer, put the computer's name in stead of localhost and the service should work.


yes i hosted my service in my computer windows vista sp1

i puted the computer's name in
XML
<host>
       <baseAddresses>
         <add baseAddress="http://localhost:ashrafelhakim/Design_Time_Addresses/Server/Service1/" />
       </baseAddresses>
     </host>



the service can't run.

and when i try to put the computer name in this
public static System.ServiceModel.EndpointAddress EndpointAddress = new System.ServiceModel.EndpointAddress("http://AshrafEL-Hakim/websitewcf/Greeting.svc");

the same error.
and when i try to change it to
and i think u mean this :
http://localhost:AshrafEl-hakim/webwebsitewcf/Greeting.svc");
the same error too :(


i understood u correct or not ? am sry
but really i need ur help :(
 
Share this answer
 
v2
Following looks fine: http://AshrafEL-Hakim/websitewcf/Greeting.svc

Now, since your mobile and your computer are not in same network, they will not be able to interact. In order to make them talk to each other, you can make use of internet. For that, you would need to understand how can we expose a service over internet. This[^] might be a good start. If you just want to check if your service is working fine, create a simple mobile application in your computer and then try to call service operation.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900