In an ASP.NET MVC webapp I developed years ago in C#, there is an action / controller that downloads an image of Google maps and saves it to disk for later use, using WebClient.DownloadData.
This action / controller is requested 4 or 5 times a day. This web app (and the action / controller) worked perfectly in development and production (in-house server, Windows Server 2008 R2 Foundation, IIS 7.5, .NET Framework v4.0).
Recently, the app was moved to a new virtual server in AWS (Windows Server 2019 Datacenter, IIS 10, .NET CLR v4.0). The whole web app seems to work fine except for the action / controller that I mentioned previously.
If I use the URL in chrome installed in the new virtual server the map is downloaded without issues. But when the action / controller is requested it times out (exception):
The code is simple:
string url = "http://maps.googleapis.com/maps/api/staticmap?key=[API_KEY]¢er=" + lat + "," + long + "&size=355x255&markers=color:red|" + lat + "," + long;
WebClient web = new WebClient();
byte[] bs = web.DownloadData(url);
// save bs in disk
This is an example of a map that it should be downloaded
http://maps.googleapis.com/maps/api/staticmap?key=[API_KEY]¢er=25.670984,-100.2850
I checked the WebClient.DownloadData documentation and I haven't found any hint of what can cause the problem.
Again, this action / controller worked perfectly fine for years but after the migration it started to fail.