Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. WebException: The underlying connection was closed: Unable to connect to the remote server

WebException: The underlying connection was closed: Unable to connect to the remote server

Scheduled Pinned Locked Moved ASP.NET
csharpsysadminwindows-adminhelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stephan Pilz
    wrote on last edited by
    #1

    Hello, I try to get a Page from a IIS with following code snippet: Dim strBody As String = "" Dim url As String = ConfigurationSettings.AppSettings("Url") & "/XXX.aspx" Dim oUri As New Uri(url) Dim oReq As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(oUri) Dim sString As String = "" ' Define the request access method. oReq.Method = "GET" oReq.KeepAlive = True ' Issue the request. Dim oResp As System.Net.WebResponse ' Issue the request. oResp = oReq.GetResponse() ' Store the response. Dim sData As System.IO.Stream = oResp.GetResponseStream() ' Read the page content and display it on the console. Dim read(2047) As [Byte] Dim bytes As Integer = sData.Read(read, 0, read.Length) While bytes > 0 sString = System.Text.Encoding.ASCII.GetString(read, 0, bytes) strBody += sString read.Clear(read, 0, read.Length) bytes = sData.Read(read, 0, read.Length) End While oResp.Close() Note: This code is inside an Aspx-Page and I want to get a Page from the same Webserver, where this Page is running. On my local machine it works fine, but on the productive system I get a WebException like this: [WebException: The underlying connection was closed: Unable to connect to the remote server.] System.Net.HttpWebRequest.CheckFinalStatus() +673 System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) +140 System.Net.HttpWebRequest.GetResponse() +147 The Exception comes too, if I run my Page direct on the productive system. I can not found any differences in the IIS-config between the prod-sys and my machine. Both computers are run in the local intranet in the same domain. Many Thanks Stephan

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups