title: Why can't I expose an interface in a .NET asmx web service?
body: <p>I have a .NET web service (using asmx...have not upgraded to WCF yet) that exposes the following:</p>
  
  <pre><code>public class WidgetVersion1 : IWidget {}
  public class WidgetVersion2 : IWidget {}
  </code></pre>
  
  <p>When I attempt to bind to the web service, I get the following serialization error:</p>
  
  <p><strong>Cannot serialize member WidgetVersion1 of type IWidget because it is an interface.</strong></p>
  
  <p>I have tried adding various attributes to the IWidget interface (<code>XmlIgnore</code>, <code>SoapIgnore</code>, <code>NonSerialized</code>), but they are not valid on an interface.</p>
  
  <p>Does anyone know why I am unable to expose the interface? I assume WSDL does not support interfaces, but couldn't .NET get around this by simply not serializing the interface? Are there any ways around this apart from removing the IWidget interface from the WidgetVersion1 and WidgetVersion2 class definitions?</p>