Blog Stats
  • Posts - 13
  • Articles - 0
  • Comments - 29
  • Trackbacks - 34

 

Sunday, March 12, 2006

System.Configuration.ConfigurationErrorsException: Unrecognized attribute 'type': Error when trying to run a WCF (Feb 06 CTP) app

If create a new WinFX service project and try to run it, you may get a System.ServiceModel.ConfigurationErrorsException if you try to configure the service's endpoint using the same app.config code included in you service definition (the app.config code is commented out in the .cs file). This is because the included configuration code has a “type” attribute on the “service” element. It looks something like this:

<service type=”sampleservice”>

If you dig into the System.ServiceModel dll using reflector, you will find the configuration element that gets instantiated by this declaration in System.ServiceModel.Configuration.ServiceElement. Once you find this class, you will notice that there is no type attribute! So the XSD file that defines the serviceModel configuration section is wrong. Instead of type, declare a “name” attribute. Your code should run fine then (at least your service will start!).

Take Care!

 

 

Copyright © Tom Wisnowski