Search code examples
iiswindows-server-2012-r2windows-serveriis-8.5

IIS monthly data limit


Can I limit the transferred data amount through IIS for a given time span? for example: max 1TB/month. (Windows Server 2012 R2 / IIS 8.5)

thank you.


Solution

  • In IIS you could use the Bandwidth Throttling which Specifies the maximum network bandwidth, in bytes per second, that is used for a site. Use this setting to help prevent overloading the network with IIS activity.

    enter image description here

    IIS does not have any native way to limit the amount of data transferred each month, so a third-party component is necessary. There are basically two ways to do this, live (with or without reading the log file), or at the end of each month. Whether you need to monitor this live, or not, depends on the situation. But keep in mind that everything that is running on the server is consuming valuable resources (CPU power and memory). So if you do not need to, do not monitor the amount of data transferred live.

    you could use some third party products or Developing your own application to limit the amount of data that can be transferred per website. All you actually need to do is read the log file (easiest, but other ways exist), and stop each website that has exceeded its allowed transfer limit. Reading the log files is easily done using the Log Parser Tool from Microsoft. Stopping a website can be done using ADSI or WMI. Also, make sure you check out the Log Parser Repository, it contains a piece of code determining the total amount of traffic over a time period, using C# and the COM object.

    reference link:

    https://learn.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms524486(v%3Dvs.90)

    https://learn.microsoft.com/en-us/iis/manage/scripting/managing-sites-with-the-iis-wmi-provider

    https://gallery.technet.microsoft.com/scriptcenter/7ee30fe9-0461-4e3e-b511-1cee14a06254

    https://www.microsoft.com/en-us/download/details.aspx?id=24659