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 7690325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:22:11+00:00 2026-05-31T20:22:11+00:00

I have a working .Net WCF HTTP service. If I put the URL into

  • 0

I have a working .Net WCF HTTP service. If I put the URL into I.E, FireFox, or google Chrome browsers, I get back the correct stream. But when I try to access that same service in an android app (running in Eclipse) I get a socketException with the detail message “Permission Denied”. The service is running on my machine in the Visual Studio web hoster and the client is running in the android emulator also on my machine.

The line that gets the exception is:
InputStream in = new BufferedInputStream(urlConnection.getInputStream());

(I have an earlier post on this same program where the url is http://www.android.com and I’m getting “invalid url”)

Might anyone have a clue why the browsers have no problem with it and the android client is getting permission denied?
thanks,
Gary

        HttpURLConnection urlConnection = null;

        try 
        {
            URL url = new URL("http://localhost:8080/TeamTask/Tasks");   
            urlConnection = (HttpURLConnection) url.openConnection();
            InputStream in = new BufferedInputStream(urlConnection.getInputStream());     
            readStream(in);
        } 
        catch (MalformedURLException e) 
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } 
        catch (IOException e) 
        {   
            e.printStackTrace();
        }  
  • 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-05-31T20:22:12+00:00Added an answer on May 31, 2026 at 8:22 pm

    A permission denied is most likely caused by not having the permission in your AndroidManifest.xml file.

    Also, and I haven’t tested it, but I would imagine that using “localhost” would not work to begin with because it is running on an emulator, just as a VM machine using localhost points back to the VM, not the host machine — put in your machine’s IP address. I’m currently testing some Android HTTP calls from a different machine, on the same network, and I simply input my server’s local IP.

    EDIT:

    Finally, here is some tried and true code I use on a regular basis for making simple HTTP call:

    public String getURLcontents(URL url) throws IOException{
        String response = "failed";
        HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
        Log.v(TAG, "Opening connection: " + url.toString());
        try {
            InputStream in = new BufferedInputStream(urlConnection.getInputStream());
            response = new Scanner(in).useDelimiter("\\A").next();
        }
        catch (Exception e) {
            urlConnection.disconnect();
            return response = "failed";
        }
        finally {
            urlConnection.disconnect();
            Log.v(TAG, "Closed connection");
        }
        return response;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on setting up a WCF REST service in .NET 4.0.
I have WCF service that has http and net.tcp endpoints. I have deployed the
I am working with WCF .NET 3.5 SP1 and have read that one does
I am trying to get MSTest working with CruiseControl.Net. I currently have it working
I have a WCF service hosted that is returning a byte[] of protobuf-net serialized
I'm trying to get IIS6 to work reliably with a WCF service I have
I've been trying to get WCF security working for my project, and have had
I have a .Net service running on IIS 6 and WCF that I want
I have a simple .NET 4 WCF service which I have hosted locally on
We have a simple WCF (on .NET 4.0) Service which uses Windows authentication and

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.