Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8309385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:06:06+00:00 2026-06-08T19:06:06+00:00

hello I have WCF service with webHttpEndpointBehavior under Sitecore 6 and I use Glass

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T19:06:07+00:00Added an answer on June 8, 2026 at 7:06 pm

    I assume you have a class that links to other classes loaded via Glass, e.g.

    [SitecoreClass]
    public class Shade{
    
        [SitecoreField]
        public virtual IEnumerable<AnotherClass> SomeField{get;set;}
    
        [SitecoreChildren]
        public virtual IEnumerable<AnotherClass> Children{get;set;}      
    }
    [SitecoreClass]
    public class AnotherClass{}
    

    To allow lazy loading of classes Glass uses proxies generated by Castle, so at runtime when the classes are loaded into the SomeField property you actually get a sub-class of the AnotherClass class.

    To resolve this you have to explicitly tell class to load the other classes as concrete types, updating the SitecoreField attribute should fix this problem:

    [SitecoreClass]
    public class Shade{
    
        [SitecoreField(Setting=SitecoreFieldSettings.DontLazyLoad)]
        public virtual IEnumerable<AnotherClass> SomeField{get;set;}
    
        [SitecoreChildren(IsLazy=false)]
        public virtual IEnumerable<AnotherClass> Children{get;set;}
    }
    [SitecoreClass]
    public class AnotherClass{}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF service where I use a customUserNamePasswordValidatorType (specified in the behaviors\serviceBehaviors\serviceCredentials\userNameAuthentication
I have created a WCF service which does not use the app.config to configure
Hello I have a simple wcf service like this, with a test method which
hello i have a desktop application that communicate with a wcf service that i
I have a very simples Hello World WCF Service, that looks like this: namespace
Hello I have next function, what always return null as result, but service calling
I have a one-way WCF service, which main purpose is to get Web Page
I have written a simple WCF web service in C# which returns records from
Hello guys I have a confusing question! If I'm using WCF to create a
I'm really new at this jquery stuff. I have a wcf web service running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.