Tuesday, May 26, 2009

SharePoint SP2 Alternate Access Mapping issue

<Update date="August, 27, 2009">
The fix for this issue has been published in August 2009 CU : http://support.microsoft.com/kb/973410. The Kb states the following
, amongst the issues fixed :
'You have a Web application that has more than five incoming URLs. You cannot change Alternate Access Mappings (AAM) settings after you install the 2007 Microsoft Office system cumulative update that was released in April 2008.'

Thank you Joe Reichard.

I wonder if any of you has encountered this problem. Just after installing WSS and MOSS SP2 and April Cumulative Updates, SharePoint began to throw the following exception, when there are multiple Alternate Access Mappings (in my case more than six) and try to add or delete one :

Unexpected end of file has occurred. The following elements are not closed: MappedUrl, AlternateDomain, AlternateDomains. Line 25, position 34.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.Throw(Int32 pos, String res, String arg)
at System.Xml.XmlTextReaderImpl.ThrowUnclosedElements()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
at Microsoft.SharePoint.Administration.SPAlternateUrlCollection.HasMissingUrl(String xml)
at Microsoft.SharePoint.Administration.SPContentDatabase.UpdateAlternateAccessMapping(SPAlternateUrlCollection collection)
at Microsoft.SharePoint.Administration.SPAlternateUrlCollection.UpdateAlternateAccessMappingInContent()
at Microsoft.SharePoint.Administration.SPAlternateUrlCollection.Update()
at Microsoft.SharePoint.Administration.SPAlternateUrlCollection.Delete(Int32 index, Boolean update)
at Microsoft.SharePoint.Administration.SPAlternateUrlCollection.Delete(String incomingUrl, Boolean update, Boolean throwIfNotFound)
at Microsoft.SharePoint.ApplicationPages.EditIncomingUrlPage.BtnDelete_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

After this exception is thrown, it's impossible to add or delete an Alternate Access Mapping, extend or unextend the web application. The same error shows.

This issue began to happen just after installing WSS and MOSS SP2 and the cumulative updates of april 2009. I have not seen it with SP1.

After many digging ups, I found out that SharePoint stores the AAMs in two places :

1. In the config DB, exactly in the dbo.Objects table
2. In the content DB, in the table dbo.DatabaseInformation in a line where the name is 'AlternateAccessMappingXml' and the value (nvarchar(1023)) is an Xml string containing all the AAMs. This line is absent in SP1.

So, the “Unexpected end of file has occurred” that SharePoint is talking about is the xml string stored in the line ‘AlternateAccessMappingXml’. Remember this string is limited to 1023 characters. Therefore, when the number of AAMs is big, it just does not fit in the field. The xml string is then truncated to 1023 characters and becomes invalid xml.

It is very easy to reproduce the issue :

1. Create a new web application with a Publishing site for example “BlueBand”.
2. Extend the Internet zone (or any zone) of the web application
3. Add six or more Alternate Access Mapping to the zone extended
4. Perform a IISRESET
5. Try to delete the last AAM or add a new one.

At the moment the only workaround I found is to alter the xml string in the content database and, make it fit in 1023 characters and well formed. Of course in coherence with what is stored in the config DB. But, I do not recommand this solution to any one since it is not supported. Use it at your own risk.

My colleague Mario Leblond has also blogged in french on this issue. You can read him here


  1. any supported workaround for this issue yet?

    need help :(

  2. Unfortunately, there is no supported workaround for the moment. I hope that the fix will be published in august 2009 CU. Meanwhile, you can raise a case to Microsoft support team and ask them if you can use the workaround without beaking your support. The workaround is :

    -Open SQL management studio
    -In query analyzer type this line :
    DELETE FROM [Your_Content_DataBaseName].[dbo].[DatabaseInformation]
    WHERE Name = ‘AlternateAccessMappingXml’
    -Execute the query

    This operation should be performed after any AAM related action. I repeat : Do not break your support, call Microsoft first. This information is posted as is without any warranty.


  3. thx for this help Djamel.

  4. Was this a 32 or 64 bit environment?

    On a 32 bit wss 3 environment, I had this error message when trying to set email property: stsadm -o setproperty -pn "Windows SharePoint Services Incoming E-Mail" -pv "Every 1 minutes between 0 and 59" . I got a similar error message as you:
    Unexpected end of file has occurred. The following elements are not closed incoming url, alternatedomain, alternatedomains, can’t remember the line reference

    I was trying to "re" set the property because email was stuck in the drop folder on the wss server and restarting admin and timer service didn't help.

    I found your article and it helped solve my email issue. After reading your article, I went to check on the AAM's and got the exact same error message when trying to set the email timer job property value.

    However, I have had SP2 and April CU on my server for over a month without issue, but after some windows patches were applied the email delivery issue occured. Weird.

  5. Hi,

    Very glad my post was helpful for you. The environment where I discovered the bug is 32 bit. I did not know that even the incoming e-mail was affected by this issue. Thank you for pointing this.
    I'm sure the bug is due to April CU. I have tested this. I would be very grateful if you post which Windows patches you have applied. This would help me investigate the issue in case the fix is not published in the coming August CU. Thank you.


  6. This issue has been addressed with the August WSS 3.0 update that can be downloaded here. I have already implemented this hotfix and it worked wonderfully.


  7. 1000 Thanks you for the information Joe.