How to eliminate from your service WSDL is the default namespace applied to WCF Services and Workflow Services.  You can and should specify your service namespace.

It is recommended that you explicitly specify a name and namespace for the service contract, and an action for each operation to avoid using "" and to prevent interface and method names from being exposed in the service’s contract
MSDN Library - Service Contract Versioning

Where is in the WSDL?

If you browse the service WSDL you will see all over the place.  Here is a default WCF service WSDL.

 <wsdl:definitions name="Service1" targetNamespace="" xmlns:wsdl="" xmlns:soap="" xmlns:soapenc="" xmlns:wsu="" xmlns:xsd="" xmlns:soap12="" xmlns:tns="" xmlns:wsa="" xmlns:wsp="" xmlns:wsap="" xmlns:wsaw="" xmlns:msc="" xmlns:wsa10="" xmlns:wsx="" xmlns:wsam="">
     <xsd:schema targetNamespace="">
       <xsd:import schemaLocation="https://localhost:63720/Service1.svc?xsd=xsd0" namespace=""/>
   <wsdl:message name="IService1_DoWork_InputMessage">
     <wsdl:part name="parameters" element="tns:DoWork"/>
   <wsdl:message name="IService1_DoWork_OutputMessage">
     <wsdl:part name="parameters" element="tns:DoWorkResponse"/>
   <wsdl:portType name="IService1">
     <wsdl:operation name="DoWork">
       <wsdl:input wsaw:Action="" message="tns:IService1_DoWork_InputMessage"/>
       <wsdl:output wsaw:Action="" message="tns:IService1_DoWork_OutputMessage"/>
   <wsdl:binding name="BasicHttpBinding_IService1" type="tns:IService1">
     <soap:binding transport=""/>
     <wsdl:operation name="DoWork">
       <soap:operation soapAction="" style="document"/>
         <soap:body use="literal"/>
         <soap:body use="literal"/>
   <wsdl:service name="Service1">
     <wsdl:port name="BasicHttpBinding_IService1" binding="tns:BasicHttpBinding_IService1">
       <soap:address location="https://localhost:63720/Service1.svc"/>

Tip: Use a constant to ensure consistency

I like to use a constant to provide a consistent namespace across my services

 public class Constants
     // Ensures consistency in the namespace declarations across services
     public const string Namespace = "";

How to eliminate from WCF Services WSDL

Step 1: Declare a namespace on your service contract

The namespace can be anything.  People typically use a URI of some form but it does not have to point to an actual web page.  Often people will use a version identifier in the namsepace but there are no rules about what you should do.

 // Eliminate from the contract
 // If you don't want to us a constant, put the URI here
 // [ServiceContract(Namespace = "")]
 [ServiceContract(Namespace = Constants.Namespace)]
 public interface IService1
     void DoWork();

Step 2: Declare a namespace on your service

The service namespace is added with a ServiceBehavior attribute.  Using the constant ensures that the namespace is the same for the contract and the service.

 // If you don't want to us a constant, put the URI here
 // [ServiceBehavior(Namespace = "")]
 [ServiceBehavior(Namespace = Constants.Namespace)]
 public class Service1 : IService1
     public void DoWork()

Step 3: Set the binding namespace

       <service name="EliminateTempUri.Service1">
         <!-- Use a bindingNamespace to eliminate -->
         <endpoint address=""
                   binding ="basicHttpBinding" 
         <behavior name="">
           <serviceMetadata httpGetEnabled="true" />
           <serviceDebug includeExceptionDetailInFaults="false" />
     <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />


How to eliminate from Workflow Services WSDL

For workflow services the process is slightly different.  Workflow services do not have a contract (it is inferred from the activities) so here is the process.

Step 1: Declare a namespace on each receive activity

I wish it were possible to use a constant here but sadly it is not.  For each receive activity you must declare the namespace and contract name using a special syntax of {namespace}IContractName.  In this example I’ve set the ServiceContractName property to {}IService


Step 2: Declare a namespace for the Workflow Service

  1. Open the Workflow Service and click in the designer outside of an activity.  This will allow you to set the properties of the service itself. 
  2. Set the Name property to use the same namespace as you see below.


Step 3: Set the binding namespace

Many people do not declare a <service> tag for their Workflow Services but if you want to eliminate you will need to declare it.

For a Workflow Service the A,B,Cs of WCF configuration are a little different.

  • Service Name – use the ConfigurationName property from the WorkflowService
  • A – Address – should be blank when hosted in IIS / AppFabric
  • B – Binding – use the binding of your choice.  Typically basicHttpBinding
  • C – Contract – use the interface name from the ServiceContractName property (without the namespace)
 <!-- For Workflow Services name is the ConfigurationName property -->
 <service name="Service2">
   <!-- contract must match the receive activity -->
   <!-- Use a bindingNamespace to eliminate -->
   <endpoint address=""
             binding ="basicHttpBinding"

Test It Out

  1. Right click on your WCF or Workflow Service in Visual Studio and select View In Browser.
  2. Click on the link to view the WSDL
  3. Search in the browser for – there should be no matches


Happy Coding!

Ron Jacobs

Twitter: @ronljacobs