| |

VerySource

 Forgot password?
 Register
Search
View: 1034|Reply: 8

Turn to static problem, use a function, error: the underlying connection is closed: this remote name cannot be resolved

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Korea, Republic of

Post time: 2020-1-21 10:20:01
| Show all posts |Read mode
I am doing a static function
  The function used is as follows, the master should be familiar with this function.
public static string GetHttpPageTest (string urllink)
{
WebResponse response = null;
Stream stream = null;
StreamReader reader = null;
// try
// {
HttpWebRequest request = (HttpWebRequest) HttpWebRequest.Create (urllink);
//request.Timeout=1000;
response = request.GetResponse ();
stream = response.GetResponseStream ();
string buffer = "", line;
reader = new StreamReader (stream, System.Text.Encoding.UTF8);
while ((line = reader.ReadLine ())! = null)
{
buffer + = line + "\r\n";
}
Ranch
//}
// catch
// {
// return "$ False $";
//}
// finally
// {
if (reader! = null) reader.Close ();
if (stream! = null) stream.Close ();
if (response! = null) response.Close ();
//}
return buffer;
}
I run locally, the address on the internet can get the corresponding html
But when I upload this program to a server on the network, it doesn't work.
The following error appears, which master to show, thank you
The underlying connection has been closed: this remote name cannot be resolved.
Explanation: An unhandled exception occurred during the execution of the current web request. Check the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The underlying connection is closed: This remote name cannot be resolved.
Reply

Use magic Report

0

Threads

18

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-2-3 21:00:01
| Show all posts
It should be that your server cannot explain this domain name,
If you can go to the terminal, go up and see if you can ping that domain name.
Or visit directly with IE, it should not be accessible.
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-2-5 10:15:01
| Show all posts
The problem of network access by the server has nothing to do with the program.
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-9 12:15:02
| Show all posts
Take a look
Is it possible that the server cannot be connected to the Internet?
Reply

Use magic Report

0

Threads

8

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-8-9 13:30:02
| Show all posts
You use try...catch to output the urllink requested when the error occurs, and then you see if the client can request the address. There are many reasons why the server cannot explain the address, one of which is that the address is blocked by our country.
Reply

Use magic Report

0

Threads

29

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-8-9 13:45:01
| Show all posts
Try another domain name...
Reply

Use magic Report

0

Threads

29

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-8-9 14:00:02
| Show all posts
Take a look
Is it possible that the server cannot be connected to the Internet?
================
!!!!!!!!!!!!!!!!!!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-25 17:30:01
| Show all posts
How to configure it on the server? Is it necessary to open a port
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-26 20:45:01
| Show all posts
Is it possible that the server cannot be connected to the Internet?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list