How To Enable Service Metadata for Workflow Services
Try this… Create a new ASP.NET Web Application (MVC or Web Forms). Then add a new a WCF Workflow Service to your web project.
Now try to add a service reference to your workflow service. It fails with an error.
There was an error downloading metadata from the address. Please verify that you have entered a valid address.
Why is this happening?
The most common reasons why this happens are
- The project won’t build for some reason
- Service Metadata is not enabled
How do I fix it?
- Build the solution and correct any compile errors.
- Start the solution and browse to the XAMLX file.
If you see this, your service does not have metadata enabled.
This is a Windows© Communication Foundation service.
Metadata publishing for this service is currently disabled.
How do I enable metadata?
The service page has some helpful tips to enable metadata for a WCF service. Unfortunately the same tips do not apply to a WCF Workflow Service. In previous releases of WCF you had to apply a service behavior using a named behavior configuration that applied to your service. In .NET 4.0 or later you do not have to use a named behavior configuration and you don’t have to declare a <service> in your configuration file for more information on this see Simplified Configuration for WCF .
Most of the time when creating Workflow Services you will use the default service configuration without declaring a <service> tag in your config file. Enabling service metadata then is a simple matter of adding the following configuration.
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Happy Coding!
Ron Jacobs
twitter: @ronljacobs