We are hosting the sitecore on to Azure Web Sites. When looking at the log files, I noticed a LARGE number of errors been logged:
ManagedPoolThread #11 2015:12:20 19:47:59 ERROR Exception in UrlAgent (url: http://localhost/sitecore/service/keepalive.aspx)
Exception: System.Net.WebException
Message: Unable to connect to the remote server
Source: System
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
at System.Net.WebClient.DownloadData(Uri address)
at System.Net.WebClient.DownloadData(String address)
at Sitecore.Web.WebUtil.ExecuteWebPage(String url, NameValueCollection headers)
at Sitecore.Web.WebUtil.ExecuteWebPage(String url)
at Sitecore.Tasks.UrlAgent.Run()
Nested Exception
Exception: System.Net.Sockets.SocketException
Message: An attempt was made to access a socket in a way forbidden by its access permissions 127.0.0.1:80
Source: System
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
We are using IPSecurity for IP whitelisting. At first it could be this and added 127.0.0.1 on to whitelisting. However I'm still getting the error above.
Somewhere I read the azure web apps doesn't support localhost or similar.
Has anyone faced this issue and have a solution?
UPDATE:
Applied the solution provided by Marek. However we are seeing new error:
Exception: System.Net.WebException
Message: The remote server returned an error: (403) Forbidden.
Source: System
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
at System.Net.WebClient.DownloadData(Uri address)
at System.Net.WebClient.DownloadData(String address)
at Sitecore.Web.WebUtil.ExecuteWebPage(String url, NameValueCollection headers)
at Sitecore.Web.WebUtil.ExecuteWebPage(String url)
at Sitecore.Tasks.UrlAgent.Run()
You can specify server url in the
keepalive
task configuration inweb.config
: