Tuesday, 24 June 2014

SharePoint Online error - Connect-SPOService : For security reasons DTD is prohibited in this XML document.

The lovely error in full

Connect-SPOService : For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method. 
At line:1 char:1
+ Connect-SPOService -Url https://XXXXX.sharepoint.com -Credential
adminuser@XXXXX ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Connect-SPOService], XmlExcep
   tion
    + FullyQualifiedErrorId : System.Xml.XmlException,Microsoft.Online.SharePo int.PowerShell.ConnectSPOService

Diagnosing the problem

So I was fiddling around with my new work laptop from home the other day and came across this error. Obviously my first port of call was the universal error solving service known as Google and this threw up a couple of likely candidates:

Both of these point to the person's local ISP being "helpful" by automatically intercepting unresolved URLs and suggesting alternatives. Both of these cases were in the UK and both were for people using Virgin Media so their resolutions weren't going to apply to me as I use the ever delightful BT for my home broadband.

Finding the resolution

The error itself gave me a pathway to finding out what BT's equivalent "Advanced Search Service" (Virgin's delightful name for their routine interception of your web traffic) was. Realising that rather than the expected response, the PowerShell cmdlet was getting back some kind of XML document, and making the wild leap in logic that if it was an ISP search 'helper' page that the "some kind of XML document" might (just might) be a web page, I fired up Fiddler and ran the Connect cmdlet again. 

This gave me the actual XML (well, OK, HTML) returned by BT's service, which I then copied into a .htm file and viewed it in the browser. This gave me the web address "http://www.webaddresshelp.bt.com/" which I then imaginatively used to search for "disable bt webaddress help". That took me to this page which has the important link with the following advice:

I used to see search results from Google/Live when I entered a keyword into the address bar. I don't want to see Yahoo! results.
You can still perform a search in the browser search box - this can be set to show results from the major search engines of your choice. 
Alternatively you can opt-out of the service at any time. Just turn it off in BT Web Address Help Preferences. (You need to be connected to your home broadband line to access preferences.)

The link above only works if you're connected to your BB router, but once you are you can simply select 'disable' and save and voila! Connect-SPOService now works like a charm.

- rob 

4 comments:

  1. Just wanted to thank you for this post as it helped me to resolve an issue I was having with Verizon and their search assist function.

    ReplyDelete
    Replies
    1. Hey no worries, glad it helped someone!

      Delete
  2. I know this is an old thread but it was high in the search results so I thought I would get the word out. The error is typically caused by your ISP's DNS failure and then you being redirected to an HTML page instead of just a good ol' 404 error. Try this: Go to your network adapter and edit your IPv4 properties. Add Google's DNS server as your DNS instead of using your ISPs by entering 8.8.8.8 and 8.8.4.4 as your primary and secondary DNS. The error magically goes away.

    ReplyDelete