3

I wanted to upload some audio files to my azure [ASP.NET] website. I then came up with this idea: I created a WebAPI action responsible for uploading the audio files into an UploadedAudio folder that I created inside the Content folder (wich is a public folder, right?). Everything is working just fine in Debug mode.

After publishing to Azure, I can see that the files are persisted with paths like D:\home\site\wwwroot\Content\UploadedAudio\5ab46baa-ffa7-4b7f-bbb9-9d0c53fa0751.mp3, but I'm not able to play them like I can in Debug mode, because I get a NotFound error. Here is the URL that I use https://mywebsite.azurewebsites.net/Content/UploadedAudio/5ab46baa-ffa7-4b7f-bbb9-9d0c53fa0751.mp3. In Debug mode, http://locahost:port/Content/UploadedAudio/5ab46baa-ffa7-4b7f-bbb9-9d0c53fa0751.mp3 is working fine!

How can I access the uploaded audio files?

I hope that my problem is clear enough. If someone can help me with this...

Thanks.

Jase
  • 149
  • 14
dafriskymonkey
  • 2,189
  • 6
  • 25
  • 48
  • 1
    See http://stackoverflow.com/questions/14323548/upload-picture-to-windows-azure-web-site. You are better off storing these files to Blob Storage instead of the website filesystem. – Brendan Green Feb 09 '15 at 03:09

1 Answers1

1

Got it !! adding these lines to the web.config is the solution:

<system.webServer>
<staticContent>
  <mimeMap fileExtension=".mp3" mimeType="application/octet-stream" />
</staticContent>

dafriskymonkey
  • 2,189
  • 6
  • 25
  • 48