0

I am creating a server that downloads an mp3 file to a local folder on the server host computer (a laptop I set up with Windows Server 2019) and then sends that mp3 file to a client. When debugging in Visual Studio, the file downloads to the server and is sent to the client perfectly. However, when deployed on IIS, the file does not download to the server; if I place a file of the same name and type in the folder from the start (so the server doesn't have to download it) the sending functionality does work (both deployed and in debug). The package I am using to download the mp3 file to the server is wrapyoutubedl, and the code it is implemented in is as follows:

                var newFilename = selectedvideo.title;
                var mp3OutputFolder = @"C:/Users/Administrator/Desktop/lowdatayt/mp3s";
                var downloader = new AudioDownloader(urlToDownload, newFilename, mp3OutputFolder);
                downloader.ProgressDownload += downloader_ProgressDownload;
                downloader.FinishedDownload += downloader_FinishedDownload;
                downloader.Download();

The error message produced when running on iis deployed is:

enter image description here

The file wasn't found because the download function didn't download it. Unfortunately, this is the only error given. As an additional note, I have granted full access to this folder to the IIS application pool this is running on, so permissions can't be the problem here.

EDIT: This thread solved my problem: Need to execute *.exe in server from ASP.net

Owen Burns
  • 120
  • 10
  • 2
    So, if I am understanding correctly, you expect IIS to be able to access the directory `C:/Users/Administrator/Desktop/lowdatayt` when 'deployed on IIS'? – stuartd Jan 02 '20 at 01:19
  • Yes; as a matter of fact it *is* able to. As I said, when a file with the same name I'm sending to the api is already in the download folder, it can access and send the file to the client (for some reason, this only works when accessing the iis site through localhost and not through the domain name it is also bound to; downloading works through neither localhost nor the domain). – Owen Burns Jan 02 '20 at 04:08
  • The best way to troubleshooting this issue is use Process monitor. Please create a filter for IIS worker process name=w3wp.exe and check whether file not found or access violation was detected. It will tell you what's wrong there.Besides, have you checked whether your authenticated user like IUSR have permission to access that file. In additon, did you try to load that file in the wrong server? – Jokies Ding Jan 02 '20 at 06:39
  • The process monitor was very helpful, and I compiled the error messages into a short log file with just the failed processes. Plenty of access violations, but I couldn't find what exactly is lacking access; IUSR and the application pool both have access. As for having it "in the wrong server", I only have one server. Here is the log file: https://drive.google.com/file/d/1e1RaNJckmZPdvld286d9PN01wCGc925b/view?usp=sharing – Owen Burns Jan 03 '20 at 02:05
  • I added registry permissions to the iusr and application pool identity but it still gives a similar set of errors (mostly with reading subkeys even though the read permission is definitely assigned). Do you have any idea of what might be wrong? – Owen Burns Jan 04 '20 at 19:40

0 Answers0