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

  • Home
  • SEARCH
  • 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 7822381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:54:43+00:00 2026-06-02T07:54:43+00:00

I am running a very simple Web application (Asp.Net MVC3) on Win 7 IIS.

  • 0

I am running a very simple Web application (Asp.Net MVC3) on Win 7 IIS.
I have a very simple HTTP GET API which returns hello world.

Calling:

http://localhost/helloworld

Returns:

Hello World!

This works perfectly over a browser.
But when I write an app which tries to pull this URL using a webclient, I get the following error:

{"Unable to read data from the transport connection: The connection was closed."}

My Code is as follows

WebClient web = new WebClient();
var response = web.DownloadString("http://localhost/helloworld");

My IIS Settings are as follows
enter image description here

What should I be looking at? I have been at this for hours and I have run out of options to try! Any help will be really appreciated!

Thanks.

  • 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-02T07:54:44+00:00Added an answer on June 2, 2026 at 7:54 am

    I finally figured out what the issue was and instead of it being an IIS specific issue – which I was leaning towards, it turned out to be an issue with the code that I wrote.

    Adding details here incase someone else runs into a similar problem.

    I had the following method in my code which I was using to send the response of the request as a JSON object.

    private void sendJsonResult(string result) {
        Response.StatusCode = 200;
        Response.Headers.Add("Content-Type", "application/json; charset=utf-8");
        Response.Flush();
        Response.Write(result);
        Response.End();
        Response.Close();    // <-- This is the problem statement
    }
    

    On digging around a bit, I found out that we should not be doing a Response.Close().

    A better explanation of this is here.
    Once I removed that line, it started working perfectly – both in my consuming app as well as the web browser, etc.

    If you will read the link above, you will clearly understand why we should not be using a Response.Close() – so I will not go into that description. Learnt a new thing today.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple Java application which downloads a set of foreign exchanges
I have a very simple app on my local machine that uses the ASP.NET
I have a very simple web-app running on GAE and we want to move
I have some ASP.NET web services which all share a common helper class they
I have a very simple test program, running on Solaris 5.8: #include <stdio.h> #include
In my web.config for my very simple web app I have the code: <sessionState
I have a very simple INSERT statement being executed from a PHP script running
Using VS2008 on my local dev machine, when I run my asp.net Web Application
I started porting a simple ASP.NET MVC web app from SQL to RavenDB. I
We're running a very time-sensitive web application (response time has to be below 100ms),

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.