Question

I'm developing an ASP.NET MVC 3 application and I'm using SWFUpload to provide ajax based file upload. The production environment is Windows Azure. It all works fine on my local box running under both IISExpress and the Windows Azure emulator. But when I have it published to Azure I get ArgumentException stating that the parameters dictionary contains a null entry.

Here's post_params snippet by viewing the source.

post_params: {
   surveyResponseId: '1918f3c3-0764-4a6a-a308-5d2180ca2eb1',
   personId: 'f5fce116-f059-48bc-be79-ad859259ffd8',
   surveyId: 'd1fa576d-d348-43e3-82ce-952f74fb0d72'
 }

When I view the operation with Fiddler2 I get a Status Code of 504. Other research indicates the 504 is Fiddler saying it's having a problem. But I can inspect the request and it includes all the posted parameters.


POST http://...
Accept: text/*
Content-Type: multipart/form-data; boundary=----------GI3cH2ei4Ef1Ij5Ij5cH2Ef1GI3GI3
User-Agent: Shockwave Flash
Content-Length: 109580
Connection: Keep-Alive
Pragma: no-cache

------------GI3cH2ei4Ef1Ij5Ij5cH2Ef1GI3GI3
Content-Disposition: form-data; name="Filename"

myimage.jpg
------------GI3cH2ei4Ef1Ij5Ij5cH2Ef1GI3GI3
Content-Disposition: form-data; name="surveyResponseId"

1918f3c3-0764-4a6a-a308-5d2180ca2eb1
------------GI3cH2ei4Ef1Ij5Ij5cH2Ef1GI3GI3
Content-Disposition: form-data; name="surveyId"

d1fa576d-d348-43e3-82ce-952f74fb0d72
------------GI3cH2ei4Ef1Ij5Ij5cH2Ef1GI3GI3
Content-Disposition: form-data; name="personId"

f5fce116-f059-48bc-be79-ad859259ffd8
------------GI3cH2ei4Ef1Ij5Ij5cH2Ef1GI3GI3
Content-Disposition: form-data; name="Filedata"; filename="myimage.jpg"
Content-Type: application/octet-stream

Any ideas? Thanks,

Update 2012-Jan-01

The file is uploaded sucessfully if I remove the parameters and the action method signature.

Was it helpful?

Solution 2

Still not sure what the problem really is, but I did find a workaround. The problem is somewhere in the model binding. If I remove the parameters from the Action method and then use the Request object to extract the File and the Form properties it works.

            var workItemId = Request.Form["surveyResponseId"];
            var arrivalId = Request.Form["surveyId"];
            var personId = Request.Form["personId"];
            var file = Request.Files[0];

So all the required values are being posted correctly it's just that the model binding can't associate them correctly with parameters. Still not sure why it works in testing, but not in production.

OTHER TIPS

Sometimes if the file size is too big, IIS can prevent file uploading. You can change the max file size allowed in web.config as shown in this link. http://www.websupergoo.com/helpupload50/source/2-tech_notes/3-web.config.htm. This may or may not be your issue but it is worth a shot.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top