IIS maxBandwidth don't limit upload - iis

i want to limit upload and download in IIS. i set maxBandwidth to 2000. this limit work for download correctly. but when upload file this limit don't work.
so how can i limit upload bandwidth in IIS?
Note
in my web.config file i set:
<system.web>
<httpRuntime maxRequestLength="2147483647" executionTimeout="3600" />
</system.web>
<system.webserver>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4249967295" />
</requestFiltering>
</security>
</system.webserver>
when i remove this line upload is limited but when add this lines uploud bandwidth is unlimited.

This is by design, the maxBandwidth setting is for download only.
IIS doesn't support any bandwith restrictions for uploads.
maxRequestLength and maxAllowedContentLength have nothing to do with bandwidth, they apply to the maximum total size of a request.

Related

Approach for archive big files in azure storage

I'm interested in what is approach for storing of sensitive data in cloud in your projects.
I want to prepare proof of concept of feature which have to archive files in Azure. We are talking about samething around 30GB of new files per day. 10-2000 MB per file.
My first idea was to use Azure Storage to store those files.
Files should be send to storage via Azure App Service so I have to prepare some WEBApi.
Based on this idea I am curious if there wont be any problems with sending such a big files to webapi?
Any tips what should I also consider?
The default request size for ASP.NET is 4MB, so you’ll need to increase that limit if you want to allow uploading and downloading of larger files.
You can do this by setting the maxRequestLength and maxAllowedContentLength values in your web.config file.
Note:the maxRequestLength value is in KB, but the maxAllowedContentLength value is in bytes.
Here is an example for increasing request limits to 2000MB:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<!-- 100 MB in kilobytes -->
<httpRuntime maxRequestLength="204800" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<!-- 100 MB in bytes -->
<requestLimits maxAllowedContentLength="209715200" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
You could use async Task, mainly for better support of handling large files.
Here is a article about uploading and downloading large file with Web API and Azure Blob Storage, you could refer to it.

How to create a virtual directory from file in IIS 8.5

I want to import virtual directory setting via file in IIS 8.5, but cannot find an option to do so. In IIS 6 you can:
Right click on the site -> New -> Virtual Directory (From File)
I do not see this option in IIS 8.5, only an option to 'Add Virtual Directory...'
Google is not helping today. Does anyone know how this can be accomplished?
I was not able to find a way to do this similar to how you can in IIS 6, maybe there is a powershell command...
However, I did find a way to add sites via the applicationHost.config file, which is usually located at: C:\Windows\System32\inetsrv\config. (be sure to make a back up of the file in case you make a booboo).
Since I have similar sites and apps, it is was easy to copy and paste, and modify the necessary fields.
You can add sites and app pools in the section:
<system.applicationHost>
App Pools:
<applicationPools>
...
Sites:
<sites>
If you have applications under a site then there has to be a corresponding location node:
<location path="Default Web Site/yoursiteapp">
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="true" />
<anonymousAuthentication enabled="false" />
</authentication>
<access sslFlags="None" />
</security>
</system.webServer>
</location>

Change script timeout on windows azure Website

How is it possible to change the script timeout on a windows azure website?
Given that you are not referring a specific language I assume it is ASP.NET. Either way, you have to change your web.config file and set the httpRuntime's executionTimeout attribute to a desired value in seconds:
<httpRuntime executionTimeout="300" />
If you are not coding in ASP.NET, just login to your web site with FTP, navigate to the site's root folder, open the web.config file and edit it. It must look something like (just a little more bloated):
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<httpRuntime executionTimeout="300" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
</configuration>
If there isn't file named web.config just create an XML file with the content above, name it web.config and place it in your site's root folder. That should do the trick for you.

IIS7 Output Caching - only lives in cache for 60 seconds?

I'm trying to cache the JSON output of an HTTP Handler (NOT an ASP.NET page, so the Page-level OutputCache directive does not apply). I'm running IIS 7.5 on Windows Server 2008.
I've added lines to the Web.config to enable caching in user mode (not kernel mode, as I need authentication):
<system.webServer>
<caching enabled="true" enableKernelCache="false">
<profiles>
<!-- cache content according to full query string for 12 hours -->
<add varyByQueryString="*" duration="12:00:00" policy="CacheForTimePeriod" extension=".aspx" />
</profiles>
</caching>
<urlCompression dynamicCompressionBeforeCache="true" />
</system.webServer>
<location path="Content">
<system.webServer>
<!-- cache content that's requested twice in 30 minutes -->
<serverRuntime enabled="true" frequentHitThreshold="2" frequentHitTimePeriod="00:30:00" />
</system.webServer>
</location>
The content does successfully cache, but it lives only for 60 seconds. I have looked all over the various config files (Web.config, applicationHost.config, machine config) for a some sort of TTL of 60 seconds, but I'm at a loss.
I suspected that the cache scavenger might be eating my cache entries each time it runs. I modified the registry key so the scavenger runs less often; that did not help.
I also suspected that IIS was overagressively clearing out the cache because the machine is using a lot of its physical RAM. This particular server has about 66% physical RAM saturation. I attempted to allocate a static amount (1 GB) to the output cache, rather than allowing IIS to manage the cache, but that was also unsuccesful.
I believe this is the same question as asked on this Stack Overflow page but that guy never got an answer.
Thanks in advance.
EDIT: I was finally able to solve this problem by modifying the OutputCacheTTL and ObjectCacheTTL registry values, as described in this very helpful article. Seems the Microsoft documentation is rather incompletel.

IIS 7 httpruntime maxRequestLength limit of 2097151

I am attempting to upload files to my Sharepoint 2010 server running on IIS 7 via the sharepoint client object model. The issue I have found is the file size limit is very well...limiting. I have read quite a few posts on the subject and it seems as though I'm running into an issue that is separate from those that I have found posted previously. After some experimentation and trying different methods I have finally found that the limit I am hitting right now is due to the following config setting in my web.config:
<system.web>
<httpRuntime maxRequestLength="2097151" />
</system.web>
Originally it was set at 51000 or so. I tried to put the 2 gig value that I have seen listed elsewhere at the theoretical maximum in for the value but when this is done the site won't load and the returned error states that the valid range for this setting is 0-2097151. I am wondering if there is somewhere else that this maximum allowed range is being set? It seems strange that it is so low, this basically limits any file upload I could provide to being only 2 megs which is smaller than the Sharepoint configurations upload limit of 50 megs.
The maxRequestLength is measured in kilobytes, so you already set it to be 2GB (2097151 / 1024 / 1024 = 2).
I have the same problem, but I found that you have to put
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
</system.webServer>
too here for some IIS up
http://ajaxuploader.com/large-file-upload-iis-asp-net.htm

Resources