A
A
Amfy2017-04-23 22:24:48
Vue.js
Amfy, 2017-04-23 22:24:48

System.Net.WebException: The connection was closed unexpectedly. How to fix?

Good evening!
Unhandled exception of type 'System.Net.WebException' in System.dll
Additional information: The request was aborted: The connection was closed unexpectedly.

public static string GetFileNameModePack(string url)
{
    string result;

    using (var client = new WebClient())
    {
        result = client.DownloadString(new Uri(url));
    }

    return result;
}

Bottom line: I specify a link to a folder with files, and if there are few files (189), then there is no error, and if there are many (1656), then an error occurs.
This is not a complete code, but it is enough to get an error. Tried to make the method both asynchronous and synchronous.
Tell me, please, how to fix it? Which day I'm raping Google, I can't decide.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Proskurin, 2018-05-14
@Konstantin18ko

Use this component (or check out the sources) https://www.npmjs.com/package/vue-search-select
There is an example moreta.github.io/vue-search-select/#/ModelAjax

D
Dmitry Gavrilenko, 2017-04-23
@Maddox

System.IO namespace
Classes File, Directory

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question