WCF 3.5 and Problem with KnownTypeAttribute - coconet

29-Feb-08 11:34:26
I have an Interface and an implementing class (receiver) and calling
class (sender) in a single DLL. The DLL is referenced in a web site
that received WCF calls and also in a seperate web site that makes
calls to the WCF site .svc. Why would I get an Exception about
KnownTypeAttribute?


InnerException thrown is:

System.Runtime.Serialization.SerializationException: Type
'nstestSecurity.TestPrincipal' with data contract name
'TestPrincipal:http://schemas.datacontract.org/2004/07/nstest.Security'
is not expected. Add any types not known statically to the list of
known types - for example, by using the KnownTypeAttribute attribute
or by adding them to the list of known types passed to
DataContractSerializer..

But my stuff looks like this:

[KnownType(typeof(IPrincipal))]
[DataContract(Name="DashboardPrincipal")]
public class TestPrincipal : IPrincipal
{
....
}

An instance of TestPrincipal is one of two parameters for a class that
uses this interface:

[ServiceContract(Name="IWcfReceiver",Namespace="http://nstest/200804/IWcfReceiver")]
public interface IWcfReceiver
{
[OperationContract]
List<ITestStuff> Do( IPrincipal inputPrincipal , List<ITestStuff>
testList );
}
reply
WCF 3.5 and Problem with KnownTypeAttribute - coconet 29-Feb-08
        RE: WCF 3.5 and Problem with KnownTypeAttribute - stchen 02-Mar-08
        RE: WCF 3.5 and Problem with KnownTypeAttribute - Marc 06-Mar-08
                Re: WCF 3.5 and Problem with KnownTypeAttribute - coconet 08-Apr-08

Try to make a web service out of a wsdl ...
  

Search

search




Purchase