Recently I came across the situation that the installation of the Dynamics AX 2009 Enterprise Portal failed.
The error message in this scenario was:
The remote server returned an error: (401) Unauthorized.
at Microsoft.Dynamics.Framework.Portal.Deployment.EPFeatureReceiver.CreateAxSitesAndPages(SPWeb site)
at Microsoft.Dynamics.Framework.Portal.Deployment.EPFeatureReceiver.ProvisionAxSite(SPWeb site)
The reason I was running into this issue was that I had the .NET Framework 3.5 Service Pack 1 already installed and the IIS web site where I was trying to install Enterprise Portal had a Host Header configured.
With the .NET Framework 3.5 Service Pack 1 changes to NTLM authentication for HTTPWebRequest were introduced. Because of these changes it is necessary that the Host Header name configured on the IIS web site is added to the BackConnectionHostNames multi-string Registry value to "inform" Windows that the Host Name used in the request is a valid alternate name for the local computer.
After making the change in the Registry and rebooting the server I could successfully install Enterprise Portal.