Vibrant discussion about CSLA .NET and using the framework to build great business applications.

Forum has moved

New location: CSLA .NET forum

CSLA .NET Resources:
  • CSLA .NET forum
  • CSLA .NET home page
  • using WCF service in mvc with csla

    rated by 0 users
    Answered (Not Verified) This post has 0 verified answers | 2 Replies | 1 Follower

    Not Ranked
    6 Posts
    Narvesh posted on Fri, Feb 14 2014 7:08 AM

    I have a WCF service Provided by csla. I want to consume this service in my MVC Project.I have create a object of service like below:

    ServiceReference2.WcfPortalClient obj = new ServiceReference2.WcfPortalClient();
     Application App = new Application();
     var AppType = App.GetType();
     ApplicationCriteria Criteria = new ApplicationCriteria {ApplicationName = "application" };
     ServiceReference2.FetchRequest Fetch1 = new ServiceReference2.FetchRequest();
     CslaTest.ServiceReference2.DataPortalContext context = new ServiceReference2.DataPortalContext();
     Fetch1._context = context;
     Fetch1._objectType= AppType;
     Fetch1._criteria = Criteria;
     var list = obj.Fetch(Fetch1);
    Getting error as:
    Type 'CslaTest.BusinessLibrary.ApplicationCriteria' with data contract name 'ApplicationCriteria:http://schemas.datacontract.org/2004/07/CslaTest.BusinessLibrary' 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.'

    All Replies

    Top 10 Contributor
    2,279 Posts
    Suggested by JonnyBee

    You got this all wrong. You should rather use the DataPortal and configure the DataPortal to use WCF as transport channel if you want to use N-Tier deployment.

    So to fetch a "root" object you just call:

    public static Order GetOrder(int id)
      return DataPortal.Fetch<Order>(id);

    and this will use the WCF channel when properly configured, f.ex:

        <add key="CslaDataPortalProxy" value="Csla.DataPortalClient.WcfProxy, Csla"/>
        <add key="CslaDataPortalUrl" value="http://localhost:21647/WcfPortal.svc"/>

    Look at the NET\cs\SimpleNTier sample in the Samples folder. This sample shows a how to use N-Tier deployment with different UI technologies, including ASP.NET MVC.


    Jonny Bekkum, Norway CslaContrib Coordinator

    Not Ranked
    5 Posts

    Hello JonnyBee,

    Could you help me with this?
    I have my mvc app working properly in IIS Express but I'm having a hard time deploying in my test server. I'm pretty sure it's related to my WcfAppServer.
    How do you go about deploying your's with WCF?
    My test server has IIS 7.5 in it and I deployed the service in it but my mvc cannot see it.



    Page 1 of 1 (3 items) | RSS

    Copyright (c) 2006-2014 Marimer LLC. All rights reserved.
    Email admin@lhotka.net for support.
    Powered by Community Server (Non-Commercial Edition), by Telligent Systems