Showing posts with label WCF. Show all posts
Showing posts with label WCF. Show all posts

WCFExtras XML comment doesn't work?

WCFExtra's is an awesome addition to any WCF project which enables you to include your code comments as documentation in the generated wsdl.

The documentation is pretty ordinary though. To make the XMLComments work first we need to follow the instructions here: https://wcfextrasplus.codeplex.com/wikipage?title=XML%20Comments&referringTitle=Documentation

Next, you need to enable XML document generation in your WCF project properties as follows: 
  1. Right click on your project and select properties
  2. Go to the build tab
  3. Tick XML documentation file. Leave the generated filename as is.

Repeat this process for any other references projects that are used in your service contract.

Now we should see wsdl:documentation tag appeared in our WSDL

WCF .svc handler mapping not working in IIS

Problem:
When trying to access a WCF .svc endpoint hosted by IIS I receive the following error "The resource you are looking for does not have a handler associated with it."

Solution:
1.    Run Server Manager (on task bar and start menu)
2.    Choose the server to administer (probably local server)
3.    Scroll down to "Roles and Features" section.
4.    Choose "Add Role or Feature" from Tasks drop down
5.    On "Add Role or Feature Wizard" dialog, click down to "Features" in list of pages on the left.
6.    Expand ".Net 3.5" or ".Net 4.5", depending on what you have installed. (you can go back up to "roles" screen to add if you don't have.
7.    Under "WCF Services", check the box for "HTTP-Activation". You can also add non-http types if you know you need them (tcp, named pipes, etc).
8.    Click "Install" Button.

Works on Windows Server 2008-2012

Prevent Service Reference from automatically implementing INotifyPropertyChanged

If for whatever reason you don't want the objects generated by your service reference to implement INotifyPropertyChanged you can stop it being generated by using <EnableDataBinding>false</EnableDataBinding> in the *.svcmap file. You have to edit the XML inside the file, its not exposed in the properties window.


<?xml version="1.0" encoding="utf-8"?>
<ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="08464769-909d-433e-ab54-b362d155f986" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap">
   < ClientOptions>
...
     EnableDataBinding>false</EnableDataBinding>
...
   < /ClientOptions>
....
</ReferenceGroup>

This makes a lot of sense if you are never going to use these events. You can also achieve this by using the svcutil.exe and not specifing the /enableDataBinding (/edb) command-line argument.