Monday, July 23, 2012

Cannot create a service reference with namespace XXX becuase the name is already in use by an existing service reference, folder or file

If you get the above error when trying to add a WCF service reference that you have previously deleted then try:
  • deleting the Service References.DeviceService.Reference.cs.dll file you'll find under obj\Debug\TempPE. 
  • deleting the service folder you'll still find under Service References on disk, even though you deleted the reference in Visual Studio.
  • commenting out all references to the service's namespace in your code
  • rebuilding

Wednesday, July 18, 2012

Could not find default endpoint element that references contract...

I created a WCF service today after a long time and I hosted it using a Windows service. While doing so I created the wcf proxy client and its config settings were generated. Then I need to use this client in my web application to call the service methods to do some work. When I did that I got the error "Could not find default endpoint element that references contract....". 

Solution: To get this error resolved one has to add the section with all the contents from proxy's app.config file to the web.config file of the web application.