none
maxItemsInObjectGraph for WCF RIA Service

    Question

  • http://forums.silverlight.net/forums/t/17674.aspx 

    I have been reading posts, but something still confuses me.

    If the service is generated dynamically, how can I control it with a web config setting?

     

            <behaviors>
                <serviceBehaviors>
                    <behavior name="-- what goes here? ---">
                        <dataContractSerializer maxItemsInObjectGraph="6553600"/>
                    </behavior>
                </serviceBehaviors>
            </behaviors>
     

    Thanks,
    Roger

    Thursday, December 03, 2009 6:32 PM

Answers

  • Ok, I'm just dense...

     

    <system.serviceModel>
        <services>
            <service name="YOURPROJECT.Web.YOURSERVICE"
                    behaviorConfiguration="YOURPROJECT-Web-YOURSERVICE">
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="YOURPROJECT-Web-YOURSERVICE">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="true" />
                    <dataContractSerializer maxItemsInObjectGraph="655360"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    

    The other examples and forum posts left out one or the other. Define your service and give it a name and behaviorConfig, then setup the serviceBehavior. I did not realize you still had to devine the service/service name even though it is dynamically created at runtime.. Duh on me...

     

    Thursday, December 03, 2009 7:18 PM

All replies

  • Ok, I'm just dense...

     

    <system.serviceModel>
        <services>
            <service name="YOURPROJECT.Web.YOURSERVICE"
                    behaviorConfiguration="YOURPROJECT-Web-YOURSERVICE">
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="YOURPROJECT-Web-YOURSERVICE">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="true" />
                    <dataContractSerializer maxItemsInObjectGraph="655360"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    

    The other examples and forum posts left out one or the other. Define your service and give it a name and behaviorConfig, then setup the serviceBehavior. I did not realize you still had to devine the service/service name even though it is dynamically created at runtime.. Duh on me...

     

    Thursday, December 03, 2009 7:18 PM
  • And I'm pretty dense too...


    The service name needs to be the service object name along with it's full name space. So if you're using the Business Application template, and you put your services in the "Services" folder, the service name will be "YOURPROJECT.Web.Services.YOURSERVICE", not "YOURPROJECT.Web.YOURSERVICE".  It took me too long to figure that out.

    Wednesday, March 10, 2010 4:14 PM
  • I'm using the Business Application template with the domainservice in the services folder and I had to use fiddler to find out where mine went.  It was in "YOURPROJECT.YOURSERVICE".  It shows up in fiddler as "/ClientBin/YOURPROJECT-YOURSERVICE.svc/binary..."

    Hiding important details from the developer is soo VB6 of the RIA team. :)

    Friday, July 08, 2011 11:53 AM
  • The url can also be seen by looking looking in the generated code.

    It isn't that the RIA Services is hiding important details, it is just how RIA Services works. It finds the assembly based on the URL. Itf sees YOURPROJECT-YOURSERVICE.svc and it looks in the loaded assemblies for a DomainService in the YourProject assembly with the name of YOURSERVICE. The server project doesn't need a reference to the DomainService or an svc file, it just needs the dll in the bin folder and it will find it at runtime.

    Friday, July 08, 2011 2:43 PM
  • An example would be really nice.

    I have problems to get this working

    Thursday, September 01, 2011 9:56 AM
  • Thank you for this well presented insight to a problem that has plagued me for the past two weeks.

    Working!

    Friday, August 24, 2012 1:38 PM
  • Thank you so much for this solution.

    After hours of desperately wondering and struggling it took me less then a minute to solve it with your addititon to the web.config.

    Thanks again.

    Thursday, September 26, 2013 11:54 AM