Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8116425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:49:48+00:00 2026-06-06T03:49:48+00:00

This is my first time that I use WCF and Android. So, sorry for

  • 0

This is my first time that I use WCF and Android. So, sorry for maybe easy question 🙂
This is from wcf service library:

[ServiceBehavior]
    public class CheckInService : ICheckInService
    {
        public string Hello()
        {
            return "Message from WCF!";
        }
    }
    [ServiceContract]
    public interface ICheckInService
    {
        [OperationContract]
        [WebInvoke(
            Method = "POST",
            UriTemplate = "Hello",
            BodyStyle = WebMessageBodyStyle.WrappedRequest,
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json)]
        string Hello();
    }

This is from wcf service web site Service.svc

<%@ ServiceHost Language="C#" Debug="true" Service="TYT.Service.CheckInService"  %>

This is app.config from wcf service library project:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <system.web>
    <compilation debug="true" />
  </system.web>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <services>
      <service name="TYT.Service.CheckInService">
        <endpoint address="publicService" binding="basicHttpBinding" contract="TYT.Service.ICheckInService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8732/Design_Time_Addresses/TYT.Service/Service1/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- 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>

This is web config from wcf service web site:

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="false" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="TYT.Service.CheckInService">
        <endpoint address="basic" binding="basicHttpBinding" bindingConfiguration=""
          contract="TYT.Service.ICheckInService" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- 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>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

ANDROID CODE

private final static String SERVICE_URI = "http://10.0.2.2/tytservice/Service.svc";    
try {



            // Send GET request to <service>/GetPlates
            HttpGet request = new HttpGet(SERVICE_URI + "/Hello");
            request.setHeader("Accept", "application/json");
            request.setHeader("Content-type", "application/json");

            DefaultHttpClient httpClient = new DefaultHttpClient();
            HttpResponse response = httpClient.execute(request);

            HttpEntity responseEntity = response.getEntity();

            // Read response data into buffer
            char[] buffer = new char[(int)responseEntity.getContentLength()];
            InputStream stream = responseEntity.getContent();
            InputStreamReader reader = new InputStreamReader(stream);
            reader.read(buffer);
            stream.close();

            String data = new String(buffer);

But in data string all I get is the whole HTML document with following error:

<span><H1>Server Error in '/tytservice' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>The resource cannot be found.</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. &nbsp;Please review the following URL and make sure that it is spelled correctly.
            <br><br>

            <b> Requested URL: </b>/tytservice/Service.svc/Hello<br><br>
...
</html>
<!-- 
[EndpointNotFoundException]: There was no channel actively listening at &#39;http://vlada-nb/tytservice/Service.svc/Hello&#39;. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening.
   at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
[HttpException]: There was no channel actively listening at &#39;http://vlada-nb/tytservice/Service.svc/Hello&#39;. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening.
   at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
   at System.Web.HttpApplication.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar)
-->

When I navigate in browser to http://localhost/tytservice/Service.svc I get service description but if I add http://localhost/tytservice/Service.svc/Hello I again get 404.
It seams that this method is not exposed but I can’t figure what I missed here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T03:49:49+00:00Added an answer on June 6, 2026 at 3:49 am

    The problem is here:

    WebInvoke(
        Method = "POST",
    

    You’re calling the method with HTTP GET, not POST:

    HttpGet request = new HttpGet(SERVICE_URI + "/Hello");
    request.setHeader("Accept", "application/json");
    // ...
    

    You can fix this by changing your method to Method = "GET", or using an HttpPost to call it.

    Also check out this related question:

    • WebInvoke Method=“POST” or "GET" for a REST Service on WCF
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the first time that I use transactions and I just wonder am
First of all, this is the first time that I use Hibernate so my
I have a database that is currently sharded. This is the first time that
This is the first time I have attempted to create a .dll, that will
That's my first time posting on stackoverflow. I've been finding usefull answers on this
this is my first time posting here, I have a question which I have
This is my first attempt to use WCF so there may be something fundamentally
this is the first time that I've posted but I tried to follow the
I'm trying to use WCF for the first time however I hit a problem
Its the first time that I use UIWebView and the first time that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.