locked
XLSX file uploads with ASP.NET and IIS7 RRS feed

  • Question

  • I did a simple file upload for XLS and XLSX files. The web server can be accessed from inside the company domain with an internal IP address and from outside the DMZ for client use.

    The file limits are set to 10Mb but there is a problem. Any upload done on the local network inside the DMZ works perfectly but from outside there is a problem with XLSX file over 2Mb, under 2Mb everything uploads.

    These are the tests files I did:

    Test_XLS.xls This is a 9Mb XLS file and it uploads no problem.

    Test_XLS.xlsx The same file as above just renamed to XLSX and it uploads no problem.

    Test_XLSX.xlsx This is a 6Mb XLSX file and it errors within about 2 to 3 seconds of hitting the upload button.

    Test_XLSX.xls The same file as above I just renamed with the XLS extension and it uploads no problem.

    The error returned is net::ERR_CONNECTION_RESET

    I looked at all the normal size limit and time-out settings in the Web.Config and in IIS, looked at the MIME maps, I also have assurance from my tech guys there are no firewall or other limits set but I cannot solve this, please help.

    Saturday, August 13, 2016 8:46 AM

Answers

  • The .xlsx and other new office formats are just renamed .zip containers full of .xml files. You can actually rename and decompress it (or just decompress with a programm that does not bother itself with fileendigns too much).

    Could it be some low level firewall or security feature blocks any transmission that looks to much like .zip/.zip beyond a certain size?
    It is a bit wierd that renaming a .xlsx to .xls solves it, but not the other way around.*

    Since it works from inside the DMZ but not from outside, it seem rather clear this is a networking issue and not a programming one. It propably never was a programming one.

    Note that the general forum for Webtechnology related stuff is this:
    http://forums.asp.net/

    *actualyl one guess could be the processing. I give you my usual "Office and .NET" explanation:
    1. If you can limit it to the new office formats (.xslx, .docx), you can use the OpenXML SDK. Or Ziparchive and XMLReader classes. Or any of the helper Libraries written around OpenXML.
    2. If you need to support the old ones or new and old ones, you need to use the (t)rusty Office COM interop. Wich requires a interactive session (no Windows Services or Webservers) and needs office installed on top of all the COM related headaches.
    3. For any given input format, output format and display technology there might be another solution. But those are far and in between.
    Maybe you are doing some processing too early and it takes plain to long in some cases, so the Connection times out? Case 2 can read both formats, but case 1 only the new ones.
    • Edited by Christopher84 Saturday, August 13, 2016 5:48 PM
    • Proposed as answer by Hart Wang Friday, August 19, 2016 8:16 AM
    • Marked as answer by DotNet Wang Wednesday, August 24, 2016 1:54 AM
    Saturday, August 13, 2016 5:45 PM

All replies

  • The .xlsx and other new office formats are just renamed .zip containers full of .xml files. You can actually rename and decompress it (or just decompress with a programm that does not bother itself with fileendigns too much).

    Could it be some low level firewall or security feature blocks any transmission that looks to much like .zip/.zip beyond a certain size?
    It is a bit wierd that renaming a .xlsx to .xls solves it, but not the other way around.*

    Since it works from inside the DMZ but not from outside, it seem rather clear this is a networking issue and not a programming one. It propably never was a programming one.

    Note that the general forum for Webtechnology related stuff is this:
    http://forums.asp.net/

    *actualyl one guess could be the processing. I give you my usual "Office and .NET" explanation:
    1. If you can limit it to the new office formats (.xslx, .docx), you can use the OpenXML SDK. Or Ziparchive and XMLReader classes. Or any of the helper Libraries written around OpenXML.
    2. If you need to support the old ones or new and old ones, you need to use the (t)rusty Office COM interop. Wich requires a interactive session (no Windows Services or Webservers) and needs office installed on top of all the COM related headaches.
    3. For any given input format, output format and display technology there might be another solution. But those are far and in between.
    Maybe you are doing some processing too early and it takes plain to long in some cases, so the Connection times out? Case 2 can read both formats, but case 1 only the new ones.
    • Edited by Christopher84 Saturday, August 13, 2016 5:48 PM
    • Proposed as answer by Hart Wang Friday, August 19, 2016 8:16 AM
    • Marked as answer by DotNet Wang Wednesday, August 24, 2016 1:54 AM
    Saturday, August 13, 2016 5:45 PM
  • Apologies will change to the asp forum, thanks for the reply though, I will have a look at the OpenXML SDK. 

    Just a further note on the problem, I created a new page with two components, the FileUpload component and a submit button, with now code behind so the file will not actually be saved and no checks but the page still fails with the XLSX files in the same way, and it happens almost immediately so very strange.  


    Sunday, August 14, 2016 3:38 PM
  • Apologies will change to the asp forum, thanks for the reply though, I will have a look at the OpenXML SDK. 

    Just a further note on the problem, I created a new page with two components, the FileUpload component and a submit button, with now code behind so the file will not actually be saved and no checks but the page still fails with the XLSX files in the same way, and it happens almost immediately so very strange.  

    Then there are some issue with the border controls at the DMZ. Generally none of the network codes bother if the other side runs on the same computer, on the same switch or on the Voyager 2 probe.

    If it works same network, but not into the DMZ it is a DMZ issue. It sounds like a networking problem, not a programming one.

    Sunday, August 14, 2016 4:30 PM
  • I still cannot get this to work, I have exhausted all avenues and no seems to know, my last actions to fix this was:

    -          All MIME types are correct.

    -          Size limits and time out settings in WEB.CONFIG and IIS7 are all correct.

    -          Firewall was disabled for one test to see if it makes a difference.

    -          Antivirus software disabled.

    -          Excel installed on the server and also MS Access redistributables.

    Created a blank asp page with only upload component and button so no client side script or server side code, file will obviously not get saved but page still fails on postback.

    Friday, August 19, 2016 8:33 AM
  • hi <g class="gr_ gr_13 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace" data-gr-id="13" id="13"><g class="gr_ gr_10 gr-alert gr_spell gr_inline_cards gr_disable_anim_appear ContextualSpelling ins-del multiReplace" data-gr-id="10" id="10">pietervanZyl</g> ,</g>

    is the issue solved <g class="gr_ gr_12 gr-alert gr_gramm gr_inline_cards gr_run_anim Style replaceWithoutSep" data-gr-id="12" id="12">?if</g> yes please provide the solution me also facing the same <g class="gr_ gr_19 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace" data-gr-id="19" id="19">issue .</g>



    • Edited by syamkrishnan Wednesday, November 21, 2018 8:03 AM edit
    Wednesday, November 21, 2018 8:02 AM