In my ASP.NET website, in order to block some countries to visit my website, I add many IP items to
The size of the file
web.config reach 1 MB, will it cause my website to be slow?
Web.config file gets loaded, when ASP.NET run time bootstraps your web site. This is one-time activity, when the web site is restarted. So, the size of 1 MB should not make your website slow.
However, basic question is: at what point you are matching the IP Address of web site? if not already doing, will advise to restrict the access via HTTP module and put it in ASP.NET pipeline towards the start.
There might be another way to block the countries - e.g. at the network layer. You should have a hole in your organisation fire wall to expose the website. You can try to coordinate with your network infrastructure, to block it at the firewall level only, thus avoiding any incoming traffic from blocked countries.