Frage

I have already set the file limits in C# file so that it checks for the file size

int filesize = personalFileUpload.PostedFile.ContentLength;

 if (filesize <= 26214400)
{

}

also in my web config file I have the following code:

 <httpRuntime executionTimeout="9999" maxRequestLength="2097151" requestValidationMode="2.0"/>

and

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="104857600" />
      </requestFiltering>
    </security>
  </system.webServer>

but still I get this error when I attach a file of about 200 MB in size:

Server Error

404 - File or directory not found.

The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

1) Is my code correct? 2) What modifications do I need to make?

War es hilfreich?

Lösung

I think the settings in your IIS is incorrect, you need to add the right MIME types for the file so that the media server could serve them up properly.

To add these MIME types here is what you do:

-Open IIS (command line inetmgr)

-Expand the Server Name

-Expand the websites

-Right Click on the website you want to edit

-Choose Properties

-Click the HTTP Headers Tab

-Click MIME Types button

-Click New button

-Type in the extension type (example .mp4 etc.)

-Type in the MIME Type (example video/mp4 etc.)

-Click OK

-Click OK

-Click OK

-Click Start

-Click Run

-Type CMD

-Hit Enter

-Type IISRESET

-Hit enter

After the IISRESET has completed you can test your webpage again and verify that the error is gone. The files should work properly now, there is a possibility you will need to reboot the server but its highly unlikely but if the files still don't work you should try a reboot next.

Reference: How to Fix the IE Error 404 - Resource You Are Looking for Might Have Been Removed
If you still have an error you could try this useful links : How to Use HTTP Detailed Errors in IIS 7.0, Troubleshoot with Failed Request Tracing

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top