WCF Add Reference Error: The document at the url was not recognized as a known document type…Report from ‘DISCO Document’ is ‘Root element is missing’…Report from WSDL Document is ‘There is an error in the XML d

Recently I surfaced this error while trying to add reference of a WCF Service in Visual Studio 2008 running on Windows 7.  Even when the WCF Service was browsed normally, it didn’t expose the Service Description Page that usually shows an implementation sample.  I tried removing all code in the service, tried commenting, nothing worked.  The ‘Root element is missing’ didn’t give much details on what could be the issue. 

Every time this error throws up, The “Add Service Reference” operation could not be completed because the options get greyed out.  This was frustrating.  After a bit of research, I found out that the WCF ServiceModel had to be registered and since I had recently upgraded to Windows 7, I hadn’t done this.  The solution for the same is to run the ServiceModelReg utility.

  • To do that, if you are on Windows Vista or Windows 7, type “cmd” in run command.
  • It lists you the Command Prompt Icon
  • Right click on the icon and select “Run as Administrator
  • Select “Yes” to continue and the command window shows up
  • In the command prompt, navigate back to C:\ by typing cd\
  • Navigate to C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation
  • Type ServiceModelReg –i and press the enter key.
  • It would do a series of installations and changes.

Thereafter you should be able to add reference to your WCF Services and also, when you browse the Service you can see the sample implementation screen as well.

For reading more about ServiceModelReg and the different switches that can be used, visit http://msdn.microsoft.com/en-us/library/ms732012.aspx

Please note, this was for WCF and if you surface the above error for WebServices, this solution may/may not work.

Cheers !!!

Print | posted on Friday, June 26, 2009 3:28 AM

Comments on this post

# WCF Add Reference Error: The document at the url was not

Requesting Gravatar...
After a bit of research, I found out that the WCF ServiceModel had to be registered and since I had recently upgraded to Windows 7, I hadn’t done this.
Left by Hampaiden Värjäytymät on May 02, 2010 4:25 AM

Your comment:

 (will show your gravatar)