Luis Mata
Luis Mata

Reputation: 73

WCF URLDownloadToFile in IIS fail download

I have a WCF application that downloads a file from an external web, in development mode it works perfect, but on the IIS server it does not download the file.

URLDownloadToFile(0, "URLFile", HttpContext.Current.Server.MapPath("~/temp/") + "img.gif", 0, IntPtr.Zero);

some help?

Upvotes: 0

Views: 83

Answers (1)

Sheng Jiang 蒋晟
Sheng Jiang 蒋晟

Reputation: 15281

URLDownloadToFile is part of WinInet, which is not supported under a windows service like IIS. See INFO: WinInet Not Supported for Use in Services for details.

Since you are using WCF, a more natural way to download files is to use the WebClient class in System.Net.

Upvotes: 1

Related Questions