title: WCF restful service cannot return base class
body: <p>I'm using a <code>WebScriptServiceHostFactory</code> based WCF Service. While it works fine with concrete classes I have difficulty dispatching a "base" class (i.e. the class which the actual output is based on).</p>
  
  <pre><code>enter code here
  </code></pre>
  
  <p>Given two classes DummyBase - a regualr not abstract class, default ctor ensured and <code>DummyConcrete</code> - inherited from <code>DummyBase</code></p>
  
  <p>The following service call fails with meaningless exception:</p>
  
  <pre><code>  &lt;WebGet(ResponseFormat:=WebMessageFormat.Json)&gt;
         Public Function GetDummy() As DummyBase
              Dim dummyConcrete As New DummyConcrete
              dummyConcrete.ConreteProperty = "Test"
  
              Return dummyConcrete
          End Function
  </code></pre>
  
  <p>once I change the return type ot <code>DummyConcrete</code> it starts working. Note, since I'm using <code>WebScriptServiceHostFactory</code> I have no interfaces/data contracts etc. I tried adding DummyConcrete as Known Type but to no avail. </p>
  
  <p>Could anyone confirm if WCF in the given setup is capable of returning base classes and if so how do I achieve it?</p>
  
  <p><strong>Update 1</strong> - The service gets hit 3 times with the same set on paramters albeit it's only called once by the client. Then the client receives the following exception:</p>
  
  <p>An unhandled exception of type 'System.Net.WebException' occurred in System.dll</p>
  
  <p>Additional information: The underlying connection was closed: An unexpected error occurred on a receive.</p>