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 !!!

posted @ Friday, June 26, 2009 3:28 AM

Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
 
 

Live Comment Preview:

 
«November»
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345