0

I have a azure function app which is reading a file. It returns the following error:

remote name could not be resolved

Code is just this like:

byte[] attachmentContent = new System.Net.WebClient().DownloadData("https://www.example.com/Document?Seqn=588736&Ikey=DF466F2A-FD14-4C48-A3E2-5E692E2EF4C9&Aseqn=1764453&noleft=1");

Edit:
1. I can open url in browser and it starts downloading it.
2. Running locally it works fine.

Help please

Tony
  • 16,527
  • 15
  • 80
  • 134
hussmom
  • 55
  • 1
  • 9
  • Try to open the URL in your computer WebBrowser and see if this succeeds. – Tony May 27 '18 at 01:29
  • @Tony I can open in browser and it starts downloading file :( – hussmom May 27 '18 at 01:35
  • Is the URL this exact `https://www.example.com/Document?Seqn=588736&Ikey=DF466F2A-FD14-4C48-A3E2-5E692E2EF4C9&Aseqn=1764453&noleft=1` ? – Tony May 27 '18 at 01:36
  • Try with another URL, like `"https://www.youtube.com/channel/UCz7WpA2ISizN-5ms0RZs9wA/?sub_confirmation=1"` I tested here and your code works with another URL. – Tony May 27 '18 at 01:38
  • Here this URL ( acnc.gov....) worked. Returned a `{byte[155267]}` – Tony May 27 '18 at 01:40
  • it work locally but in azure it throws error – hussmom May 27 '18 at 01:42
  • Is it Azure Functions v1 or v2? – Tony May 27 '18 at 01:43
  • Put the complete code. Maybe the problem is another line. I tested this line here and it worked OK. – Tony May 27 '18 at 01:48
  • are you able to download file please ? – hussmom May 27 '18 at 01:52
  • Yes, worked fine here. Did you click the link I put? See, it downloads the file in the function and return a json with the file lenght. – Tony May 27 '18 at 01:53
  • also will there be difference of setting between functions and api ? I m using Function v1. – hussmom May 27 '18 at 01:53
  • V1 has different way to return response. Please post the code of this function on this question. – Tony May 27 '18 at 01:55
  • 1
    @Tony it is very long code but this line has error, so now in a new function I m testing only this line with try catch. – hussmom May 27 '18 at 02:04
  • Please try to download the same file via `curl` (or just `nslookup`) from your Function App's Kudu Console. This way, you remove Azure Functions from the equation. See [this page](https://github.com/projectkudu/kudu/wiki/Isolating-WebJobs-and-Deployment-script-issues). – David Ebbo May 27 '18 at 02:16
  • @DavidEbbo tried curl with domain, got a few errors and top was similar "curl: (6) Couldn't resolve host 'www.example.com' – hussmom May 27 '18 at 02:49
  • So it's done DNS resolution issue. Do you get the same for any other domain, or just the one you're using? – David Ebbo May 27 '18 at 02:51
  • @DavidEbbo just with this one but strange is locally it works fine. DNS resolution is about server I m accessing right ? – hussmom May 27 '18 at 02:53
  • As a test, try both `nslookup example.com` and `nslookup example.com 8.8.8.8` (the second one uses a different DNS server). But you'll need to share the specific domain name for further investigation (or open support case). – David Ebbo May 27 '18 at 03:03
  • Can you download the file using a private window? Isn't there any authentication/redirect in place? – pijemcolu May 27 '18 at 12:54

0 Answers0