Why is WebClient DownloadData working on IIS Express but not on IIS?












0















I have the following piece of code that is getting some data from a url.



WebClient webClient = new WebClient();
byte imageBytes = webClient.DownloadData(url);


The url variable is just a string but didn't work even if I make it a Uri.



While this is working fine when I'm running the site using IIS Express, when I load it via IIS the webClient.DownloadData(url) call is throwing an exception with message: "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond IP:port", where IP and port are the values for the ip and port of the url I'm trying to access.



Also, if I go directly to that url using a browser it works fine. I turned the firewall completely off in case it was blocking the response from the external site but didn't make any difference.
Thanks










share|improve this question























  • what is the url?

    – Hassaan
    Nov 16 '18 at 13:30











  • Have you tried it with a different URL, for example one at google?

    – Andrew Morton
    Nov 16 '18 at 13:32











  • Most obvious difference is that IIS Express runs under your user account whereas IIS will be running under other accounts (that may not have network credentials). Are you running on a home/unmanaged network or a work/managed network environment, where e.g. proxy and firewall rules may be implemented by other network devices?

    – Damien_The_Unbeliever
    Nov 16 '18 at 13:39











  • I tried a URL pointing to Google but failed too.

    – msokrates
    Nov 16 '18 at 13:39











  • I'm running it on a work network, behind a proxy. This is failing on my dev machine though

    – msokrates
    Nov 16 '18 at 13:40


















0















I have the following piece of code that is getting some data from a url.



WebClient webClient = new WebClient();
byte imageBytes = webClient.DownloadData(url);


The url variable is just a string but didn't work even if I make it a Uri.



While this is working fine when I'm running the site using IIS Express, when I load it via IIS the webClient.DownloadData(url) call is throwing an exception with message: "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond IP:port", where IP and port are the values for the ip and port of the url I'm trying to access.



Also, if I go directly to that url using a browser it works fine. I turned the firewall completely off in case it was blocking the response from the external site but didn't make any difference.
Thanks










share|improve this question























  • what is the url?

    – Hassaan
    Nov 16 '18 at 13:30











  • Have you tried it with a different URL, for example one at google?

    – Andrew Morton
    Nov 16 '18 at 13:32











  • Most obvious difference is that IIS Express runs under your user account whereas IIS will be running under other accounts (that may not have network credentials). Are you running on a home/unmanaged network or a work/managed network environment, where e.g. proxy and firewall rules may be implemented by other network devices?

    – Damien_The_Unbeliever
    Nov 16 '18 at 13:39











  • I tried a URL pointing to Google but failed too.

    – msokrates
    Nov 16 '18 at 13:39











  • I'm running it on a work network, behind a proxy. This is failing on my dev machine though

    – msokrates
    Nov 16 '18 at 13:40
















0












0








0








I have the following piece of code that is getting some data from a url.



WebClient webClient = new WebClient();
byte imageBytes = webClient.DownloadData(url);


The url variable is just a string but didn't work even if I make it a Uri.



While this is working fine when I'm running the site using IIS Express, when I load it via IIS the webClient.DownloadData(url) call is throwing an exception with message: "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond IP:port", where IP and port are the values for the ip and port of the url I'm trying to access.



Also, if I go directly to that url using a browser it works fine. I turned the firewall completely off in case it was blocking the response from the external site but didn't make any difference.
Thanks










share|improve this question














I have the following piece of code that is getting some data from a url.



WebClient webClient = new WebClient();
byte imageBytes = webClient.DownloadData(url);


The url variable is just a string but didn't work even if I make it a Uri.



While this is working fine when I'm running the site using IIS Express, when I load it via IIS the webClient.DownloadData(url) call is throwing an exception with message: "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond IP:port", where IP and port are the values for the ip and port of the url I'm trying to access.



Also, if I go directly to that url using a browser it works fine. I turned the firewall completely off in case it was blocking the response from the external site but didn't make any difference.
Thanks







c# iis iis-express webclient-download






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 13:26









msokratesmsokrates

1517




1517













  • what is the url?

    – Hassaan
    Nov 16 '18 at 13:30











  • Have you tried it with a different URL, for example one at google?

    – Andrew Morton
    Nov 16 '18 at 13:32











  • Most obvious difference is that IIS Express runs under your user account whereas IIS will be running under other accounts (that may not have network credentials). Are you running on a home/unmanaged network or a work/managed network environment, where e.g. proxy and firewall rules may be implemented by other network devices?

    – Damien_The_Unbeliever
    Nov 16 '18 at 13:39











  • I tried a URL pointing to Google but failed too.

    – msokrates
    Nov 16 '18 at 13:39











  • I'm running it on a work network, behind a proxy. This is failing on my dev machine though

    – msokrates
    Nov 16 '18 at 13:40





















  • what is the url?

    – Hassaan
    Nov 16 '18 at 13:30











  • Have you tried it with a different URL, for example one at google?

    – Andrew Morton
    Nov 16 '18 at 13:32











  • Most obvious difference is that IIS Express runs under your user account whereas IIS will be running under other accounts (that may not have network credentials). Are you running on a home/unmanaged network or a work/managed network environment, where e.g. proxy and firewall rules may be implemented by other network devices?

    – Damien_The_Unbeliever
    Nov 16 '18 at 13:39











  • I tried a URL pointing to Google but failed too.

    – msokrates
    Nov 16 '18 at 13:39











  • I'm running it on a work network, behind a proxy. This is failing on my dev machine though

    – msokrates
    Nov 16 '18 at 13:40



















what is the url?

– Hassaan
Nov 16 '18 at 13:30





what is the url?

– Hassaan
Nov 16 '18 at 13:30













Have you tried it with a different URL, for example one at google?

– Andrew Morton
Nov 16 '18 at 13:32





Have you tried it with a different URL, for example one at google?

– Andrew Morton
Nov 16 '18 at 13:32













Most obvious difference is that IIS Express runs under your user account whereas IIS will be running under other accounts (that may not have network credentials). Are you running on a home/unmanaged network or a work/managed network environment, where e.g. proxy and firewall rules may be implemented by other network devices?

– Damien_The_Unbeliever
Nov 16 '18 at 13:39





Most obvious difference is that IIS Express runs under your user account whereas IIS will be running under other accounts (that may not have network credentials). Are you running on a home/unmanaged network or a work/managed network environment, where e.g. proxy and firewall rules may be implemented by other network devices?

– Damien_The_Unbeliever
Nov 16 '18 at 13:39













I tried a URL pointing to Google but failed too.

– msokrates
Nov 16 '18 at 13:39





I tried a URL pointing to Google but failed too.

– msokrates
Nov 16 '18 at 13:39













I'm running it on a work network, behind a proxy. This is failing on my dev machine though

– msokrates
Nov 16 '18 at 13:40







I'm running it on a work network, behind a proxy. This is failing on my dev machine though

– msokrates
Nov 16 '18 at 13:40














0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53338810%2fwhy-is-webclient-downloaddata-working-on-iis-express-but-not-on-iis%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53338810%2fwhy-is-webclient-downloaddata-working-on-iis-express-but-not-on-iis%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)