I'm working on a ASP.NET MVC4 solution to upload PDFs via drag and drop to the browser. My solution was working fine until I upgraded my Azure website (it's a "standard" Azure website not a web role). The Javascript code:
function uploadFile(file, documentId) {
uploadUrl = '/Reports/UploadPdf';
var xhr = new XMLHttpRequest();
xhr.open("post", uploadUrl, true);
// Set appropriate headers
xhr.setRequestHeader("Content-Type", "multipart/form-data");
xhr.setRequestHeader("X-File-Name", file.name);
xhr.setRequestHeader("X-File-Size", file.size);
xhr.setRequestHeader("X-File-Type", file.type);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
//alert("Received:" + xhr.responseText);
//addPdfToUi(JSON.parse(xhr.responseText));
pdfUploaded(JSON.parse(xhr.responseText));
//addPdfToWorkspace();
}
else
alert("Error code " + xhr.status);
}
};
if (xhr.upload) { // check if upload property exists
xhr.upload.addEventListener('progress', updateProgress, false);
}
initProgressBar();
xhr.send(file);
It previously uploaded the PDF seamlessly. Now it sends me back a 504 server error.
I suspect my website may have been upgraded to a different version of IIS in the background.
It still works on my local machine.
I've used Fiddler, Chrome Tools and turned on verbose error logging on the server side. No clues. It's definitely a server issue since it works locally for both Chrome and IE but neither work when it's on Azure.
Any ideas?