I am trying to upload a file to an application i have built using the AsyncFileUpload part of the AjaxToolKit. The file is a 50mb ZIP file, when uploading i receive the following popup:
When i click OK i get the following box
If i then go into Developer tools i get the following error message in the console tab of chrome
The value for Content Security Policy directive 'object-src' contains an invalid character
Any help would be appreciated
It looks like you need to modify your Web.config like in this answer:
<configuration>
<system.web>
<httpRuntime maxRequestLength="1048576" />
</system.web>
</configuration>
or for IIS 7 or later:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
Related
I am trying to upload files using my .NET application. I cannot upload large files and it responds with 413 - Request Entity Too Large.
I tried solutions that suggested changing maxRequestLength and maxAllowedContentLength in web.config. Also changed the uploadReadAhead setting in IIS. I still am unable to upload the files.
The project has two web configs. Parent directory web config has the following settings:
<system.web>
...other lines
<compilation targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1" maxRequestLength="2147483647" executionTimeout="999999" />
<customErrors mode="Off" />
</system.web>
The web config in the inner Portal directory has:
<system.web>
...other lines
<httpRuntime targetFramework="4.6.1" requestValidationMode="2.0" executionTimeout="999999" useFullyQualifiedRedirectUrl="true" maxRequestLength="2147483647" />
</system.web>
<system.webServer>
...other lines
<httpRuntime targetFramework="4.6.1" requestValidationMode="2.0" executionTimeout="999999" useFullyQualifiedRedirectUrl="true" maxRequestLength="2147483647" />
</system.webServer>
How do I fix this ?
Thanks.
Hum, that should be fine. On the other hand, seems to me that adopting some kind of nice up-loading library that up-loads in chunks would be better. This tends to "less freeze up" the user interface and also tends to not freeze up the web server either.
I mean, for a user to up-load a big file, then they are going to be stuck watching the screen - nothing occuring. With a nice up-loader library, then only small chunks are sent up, you get a progess bar, and you have un-limited up-load file sizes.
However, you could try in the main web.config,
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2048000000"/>
</requestFiltering>
</security>
</system.webServer>
So, you could try adding above under system.webServer
I am trying to upload a file using C# and ASP.NET MVC, and I am getting this error:
HTTP Error 413.1 - Request Entity Too Large
The request filtering module is configured to deny a request that exceeds the request content length.
This is how I configure my web.config:
<system.web>
<authentication mode="None"/>
<compilation debug="true" targetFramework="4.7.2"/>
<httpRuntime targetFramework="4.7.2" executionTimeout="3600" maxRequestLength="104857600" enable="true"/>
</system.web>
For IIS7 and above, you also need to add the lines below:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
In our Web API, we can not upload fize size which is more than 30MB. We used to get 404 Error such as "404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable."
By Googling and seeing various post, I tired the below changes in my config file:
Web.Config:
<system.web>
<httpRuntime maxRequestLength="204800" timeout="7200" />
</system.web>
<requestFiltering>
<requestLimits maxAllowedContentLength="209715200" maxQueryString="2097151" maxUrl="10999"/>
</requestFiltering>
But still, I could not upload file which is more than 30MB size. But the same code is working fine to upload file which is below 30 MB.
Any thing that i had missed here?
1.) Open IIS Manager.
2.) Select the website that you want to configure.
3.) Make sure you are in Features View per the button at the bottom of the manager.
4.) Select Requests Filtering and open it by double-clicking the icon. The Request Filtering pane displays.
5.) From the Actions pane on the right hand side of the screen click Edit Feature Settings... link. The Edit Request Filtering Settings window displays.
6.) In the Request Limits section, enter the appropriate Maximum allowed content length (Bytes) and then click the OK button.
Restart IIS.
This worked for me :)
Can you change your web.config to use system.webServer and security?
<configuration>
<system.web>
<httpRuntime maxRequestLength="204800" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="209715200" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
Putting in what worked for me.
I had to make two changes:
update web.config with following settings:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="209715200" />
</requestFiltering>
</security>
</system.webServer>
But using just this was not working for me. I had to add another attribute to API Controller to make it work.
[HttpPost]
//[DisableRequestSizeLimit]
[RequestSizeLimit(70_000_000)] //Files sizes upto 70 MB are allowed
My setup was Blazor WebAssembly template with ASP Hosted option. Hope this helps somebody.
In my application I'm uploading large audio files (upto 100MB). For that in my web.config file I have added:
<httpRuntime executionTimeout="90" maxRequestLength="150000" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="true" />
With this code I'm uploading files successfully into my application folder. But when deployed in IIS and published locally, the files are not uploading and I'm getting this Error. How can i solve this issue?
In addition to the check specified in the httpRuntime node, I believe microsoft is now also checking the content length as part of the security filtering. You may be able to get past the size limits by adding the following node to your web.config
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="100000000" />
</requestFiltering>
</security>
</system.webServer>
I am trying to upload file from my one of Windows phone 8 application. We are using MVC4 web API which is working perfectly fine until and unless file size is less than 5 MB. Any file with more than 5 MB is giving me 404(Not found) in response.
I think from API side there is no problem as I am able to upload the same file using Fiddler with no error.
I am using HttpClient to post request to service.
Any help will be highly appreciated.
Vinod
Try increasing the MaxRequestSize in the web.config for the mvc site
<configuration>
<system.web>
<httpRuntime maxRequestLength="10240" />
</system.web>
</configuration>
In IIS 7+ try this
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="52428800" /> <!--50MB-->
</requestFiltering>
</security>
</system.webServer>
Just make these changes in web.config file:
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" maxRequestLength="2147483647" executionTimeout="1600" requestLengthDiskThreshold="2147483647" />
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483647" />
</requestFiltering>
</security>
...