hello I have WCF service with webHttpEndpointBehavior
under Sitecore 6 and I use Glass Mapper to read items, Glass mapper has depends on Castle library.
It is working well, but i have some methods with Contract like:
[OperationContract]
[WebInvoke(Method = "POST",BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
List<Shade> GetAllShades(int columns, int rows);
where I try return list of my class in JSON format, during debug my service with SvcTraceViewer.exe I find out next error:
There was an error while trying to serialize parameter :GetFamilyShadesResult. The InnerException message was 'Type 'Castle.Proxies.ShadeProxy' with data contract name 'ShadeProxy:http://schemas.datacontract.org/2004/07/Castle.Proxies' is not expected. Consider using a DataContractResolver or 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.'. Please see InnerException for more details.
How to resole this issue? Castle.Proxies.ShadeProxy
is a dynamic class under Castle and I can't use KnownTypeAttribute
.
Actually if I JSON.net library and return results as string everything works fine.