WinRT config for WCF

WinRT config for WCF

Old forum URL: forums.lhotka.net/forums/t/11649.aspx


jteneglio posted on Saturday, October 20, 2012

we are new with CSLA and WinRT and we are building an LOB app, evaluating CSLA.  I built a proof of concept with CSLA and WinRT, the problem is, it seems that the configuration in the application to connect to CSLA Business Object on the WCF server is wrong or blocked or something, it just hang ...

Do you have an sample app i could use to validate that we are doing thigns right.

 

thanks,

tiago replied on Saturday, October 20, 2012

There are two sample apps on

http://www.lhotka.net/cslacvs/viewvc.cgi/core/trunk/Samples/NET/cs/

SimpleNTier is just a proof of concept in the sense it doesn't use a database.

ProjectTracker is a complete application.

jteneglio replied on Saturday, October 20, 2012

Thanks,  How do you download those, is that SVN?

tiago replied on Saturday, October 20, 2012

Yes, that's SVN

svn://svn.lhotka.net/csla/core/trunk/Samples

 

jteneglio replied on Saturday, October 20, 2012

Ok I downloaded the sample app and tried it, I get this after fixing the CSLA references with NUGET

{"Object type or assembly could not be loaded (Library.CustomerEdit, Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null)"}

'((Csla.DataPortalException)($exception)).BusinessException' threw an exception of type 'System.NullReferenceException'

All libraries seems to be there ?? any thoughts?

tiago replied on Saturday, October 20, 2012

Do you get any build errors? You shouldn't need to fix any dependency.

You should download the samples folder as there is a dependencies folder you will need to build the samples. They open on VS2012. Use F5 and not CTRL F5 to run them.

jteneglio replied on Saturday, October 20, 2012

Here is what i did,

  1. Got the code from SVN
  2. Open Visual Studio and opened solution named SimpleApp.sln
  3. Pressed F5

It loaded the app , then the screen, waited a bit then stopped on 

var obj = await Library.CustomerEdit.GetCustomerEditAsync(441)

With this error

Object type or assembly could not be loaded (Library.CustomerEdit, Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null)

THis time I did not fix anything, just run the project as is

tiago replied on Sunday, October 21, 2012

First of all I'm running Windows7 so no WinRT available on my side.

There are SimpleApp solutions for different environments: Silverlight, IOS, Android, WindowsPhone and WinRT. I guess you were running the later.

I suggested ProjectTracker or SimpleNTier that are under the NET folder and are a showcase as they have UI clients for different technologies including WinRT. I tested these projects on everything except WinRT. I know Rocky has done some recent work on these projects so I expect they also run on WinRT.

jteneglio replied on Sunday, October 21, 2012

Every sample app i tried i get the same error

Object type or assembly could not be loaded (ProjectTracker.Library.Dashboard, ProjectTracker.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null)

Maybe there is a problem with the CSLA version 4.5.4.0?

tiago replied on Sunday, October 21, 2012

I don't believe that your issue is due to any problem on Csla 4.5.4.

1) Do all projects build?

2) Can you run other UI projects of ProjectTracker solution?

JonnyBee replied on Sunday, October 21, 2012

The WinRT/SimpleApp in "trunk" runs fine on my Win8 computer.

You may need to add the Csla.pri and Csla.Xaml.pri to  the dependencies folder manually.  (just fixed last week).

There is no more app.config file in WinRT so the config must be done in code.
For SimpleApp this is done in App.xaml.cs - OnLainched event in codebehind.

    protected override void OnLaunched(LaunchActivatedEventArgs args)
    {
      Csla.ApplicationContext.DataPortalProxy = typeof(Csla.DataPortalClient.WcfProxy).AssemblyQualifiedName;
      Csla.ApplicationContext.DataPortalUrlString = "http://localhost:19454/MobilePortal.svc";
      // .......

The exception message that you gets indicated the the :net library assembly is not present on the WCF AppServer bin folder.

jteneglio replied on Sunday, October 21, 2012

Ok the sample app is working, I had to replace all the CSLA*.dll in each project with the ones in Dependencies... it all works now, thanks for the help

 

Now let's see if it works in my app

jteneglio replied on Monday, October 22, 2012

In my application it hangs on the server, i can see the WCF trace and i see this

Activity Name Process action 'http://ws.lhotka.net/WcfDataPortal/IWcfPortal/Fetch'.
Related Activity Name Execute 'Csla.Server.Hosts.Mobile.IWcfPortal.Fetch'.
Time 2012-10-22 02:14:25.0189
Level Transfer
Source System.ServiceModel
Process iisexpress
Thread 9

Nothing else, seen that before?

jteneglio replied on Thursday, November 01, 2012

Ok by changing a bit the code i use in my WinRT application i got a better error then NONE :-)

 

Could not load file or assembly 'Global.Business.WinRT, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

This is the same error that i got when i tried the simpleapp downloaded from http://www.lhotka.net when i tried to use the NuGet Package...

I did try to use the same CSLA.DLL that came from the SimpleApp but i get the same error

 Any Ideas?

JonnyBee replied on Thursday, November 01, 2012

Your WinRT and .NET assemblies MUST have the same name for CSLA Serialization to work. 

It seems like you haven´t edited the project assembly names and namespaces to be the same (equal).

Your business assembly for WinRT should be named Global.Business.dll as the .NET assembly must be named too. 

jteneglio replied on Thursday, November 01, 2012

i'm getting closer, now i'm getting this

 

DataPortal.Fetch failed (Object reference not set to an instance of an object.)

Copyright (c) Marimer LLC