Nil Pun
Nil Pun

Reputation: 17373

Sitecore 8.1 : azure website forbidden by its access permissions 127.0.0.1

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()

Upvotes: 0

Views: 951

Answers (2)

ob1dev
ob1dev

Reputation: 1230

You can use the relative URL instead of absolute. For example:

<param desc="url">/sitecore/service/keepalive.aspx</param>

If you are using the Static/Dynamic IP Restrictions with Azure Web Apps, do not forgot to add the internal Azure IP Address into the <ipSecurity /> section.

<security>
  <ipSecurity allowUnlisted="false">
    <clear/>
    <add ipAddress="0.0.0.0" allowed="true"/>
    ...
  </ipSecurity>
</security>

Upvotes: 1

Marek Musielak
Marek Musielak

Reputation: 27132

You can specify server url in the keepalive task configuration in web.config:

  <agent type="Sitecore.Tasks.UrlAgent" method="Run" interval="00:15:00">
    <param desc="url">http://YOUR_VALID_HOSTNAME/sitecore/service/keepalive.aspx</param>
    <LogActivity>true</LogActivity>
  </agent>

Upvotes: 2

Related Questions