This Forum is ARCHIVE only
For LightSwitch questions,
please use the official forums at:

http://social.msdn.microsoft.com/forums/en-US/lightswitch/threads


Creating A WCF RIA Service Using Entity Framework
Last Post 25 Jul 2013 10:05 PM by admin. 48 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Page 2 of 3 << < 123 > >>
Author Messages
Michael WashingtonUser is Offline
Send Private Message
Posts:1313
Avatar

--
05 Aug 2011 08:46 AM
Please see the example "WCF RIA Service: Combining Two Tables" on the downloads page as a good simple example that is easy to run.
-----------
Michael Washington
http://LightSwitchHelpWebsite.com
Amon-Ra MackieUser is Offline
New Member
New Member
Send Private Message
Posts:1
Avatar

--
16 Aug 2011 07:57 PM


I had this same issue and waisted a couple of days on this error until I found out about the Trace.axd.  To enable this file for diagnostics please see How to: Enable Diagnostics.

After viewing the generated Trace page, I discovered the exception below.  My MSDTC (Distributed Transaction Coordinator) service was not running.  After I started the service, clear sailing.

Microsoft.LightSwitch.DataService[Microsoft.LightSwitch.DataService][Application:Information][LightSwitchApplication.OjaDomainServiceData:Applicants_AllataProviderQuery] source.OrderBy(e => e.username).Skip(0).Take(45)0.02049350678439840.018654 Microsoft.LightSwitch.DataService[Microsoft.LightSwitch.DataService][Application:Error][LightSwitchApplication.OjaDomainServiceData:Applicants_All] An exception has occurred:  Microsoft.LightSwitch.DataServiceOperationException: The underlying provider failed on Open. ---> System.Data.EntityException: The underlying provider failed on Open. ---> System.Data.SqlClient.SqlException: MSDTC on server 'XXXX' is unavailable.
  at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

Error Reference: "Unable to load data. Please check your network connectivity and try loading again"
stevenUser is Offline
New Member
New Member
Send Private Message
Posts:1
Avatar

--
04 Dec 2011 10:31 AM
Hi Michael, I am not sure if this is too late. After reading this blog and combining two tables, I am greatly confused. In the combining two tables example, you used poco and domain service, but in this one, you used ADO.NET Entity data model.
Now what I dont know is, when should I use domain service and when to use Entity data model? Please help me.
Michael WashingtonUser is Offline
Send Private Message
Posts:1313
Avatar

--
04 Dec 2011 08:11 PM
You can use all the methods depending on your preference.
-----------
Michael Washington
http://LightSwitchHelpWebsite.com
JamesUser is Offline
New Member
New Member
Send Private Message
Posts:4
Avatar

--
02 Jan 2012 02:05 PM

Did you end up finding a solution to the red crosses? I suspect the connection string is in the wrong format.

What did you do to get this working? Thanks. James.

JamesUser is Offline
New Member
New Member
Send Private Message
Posts:4
Avatar

--
03 Jan 2012 08:23 AM

G'Day Michael,
I was really impressed on how easy it is to create a RIA Service.

However, I too have the red cross issue with my RIA Service.

I would really appreciate your reply. We are a company and we are really pressing to get RIA Services available for Lightswitch.

I have tried to change the connection string to the Lightswitch connection string. I have even tried entering the connection string when updating the RIA Data Service.

PLEASE, could you help us. I look forward to your response.

James Black,
Intechrity

Michael WashingtonUser is Offline
Send Private Message
Posts:1313
Avatar

--
03 Jan 2012 09:06 AM
I am sorry but I have never had that error. I am at a loss as to what is causing it.
-----------
Michael Washington
http://LightSwitchHelpWebsite.com
JamesUser is Offline
New Member
New Member
Send Private Message
Posts:4
Avatar

--
03 Jan 2012 11:06 AM

Michael,
I can see that the RIA Service returns a dataset to the client so there is nothing wrong with the service from what I can tell.

However, from the point of returning to Lightswitch, the red crosses appear. How would you go about debugging such a problem? Is there a way to trace Lightswitch (for example)? Or is there a way to turn on detailed error messages? There must be something further that can be done to diagnose the problem.

Thank You,
James Black

Michael WashingtonUser is Offline
Send Private Message
Posts:1313
Avatar

--
03 Jan 2012 11:21 AM
-----------
Michael Washington
http://LightSwitchHelpWebsite.com
Charlie BarnettUser is Offline
New Member
New Member
Send Private Message
Posts:2
Avatar

--
06 Jan 2012 12:30 AM
Used article to create RIA service. All worked fine but when run get message "Unable to load data. Please Check your network connection and try loading again". Was able to verify that data was being retieved from the RIA sevice but (halt in DomainService code that retrieves data) and that exception was being thrown ( halt in Agencies_All_ExecuteFailed method in LS data source). Inner exceptiion message describes errors with MSDTC. Data base is running on a 2003 server under mssql 2005. Playing with security settings for DTC on my desk top and server leads to different error messages all of which refer to DTC but no combinations I have tried result in the data being displayed. Any suggestions would be appreciated.

Nice series of articles. The simple RIA service was particularly informative.

Was able to use data base as a data source with light switch but would like to use RIA service because two fields in one table are encrypted.

Thanks, Charlie Barnett
Michael WashingtonUser is Offline
Send Private Message
Posts:1313
Avatar

--
06 Jan 2012 12:41 AM
On the MSDTC issue, I have found that the problem was in the database connection string I used in my WCF RIA Service. You will want to google "MSDTC LightSwitch connection strings".

Also, download and run the examples I have and see if they work for you.
-----------
Michael Washington
http://LightSwitchHelpWebsite.com
Charlie BarnettUser is Offline
New Member
New Member
Send Private Message
Posts:2
Avatar

--
06 Jan 2012 12:59 AM
Thanks Michael

Enlist=false in the connection string did the trick.

Charlie Barnett
Tuan TranUser is Offline
New Member
New Member
Send Private Message
Posts:1
Avatar

--
18 May 2012 02:53 AM

This is the solution for ERROR: MSDTC on server 'servername' is unavailable.

RESOLUTION
On the server where the trigger resides, you need to turn the MSDTC service on. You can this by clicking START > SETTINGS > CONTROL PANEL > ADMINISTRATIVE TOOLS > SERVICES. Find the service called 'Distributed Transaction Coordinator' and RIGHT CLICK (on it and select) > Start.

It resolves the MSDTC problem that I get in LightSwitch
Norbert KramerUser is Offline
New Member
New Member
Send Private Message
Posts:2
Avatar

--
27 Aug 2012 10:09 PM
Hi Michael,

I have followed your instructions on making a WCF RIA Service in LightSwitch. Only difference is that I use Visual Studio 12.
This seems to add a new challenge in establishing the service.

Fist the reference to the service did not show up.
If fix this by following instructions on:
http://support.microsoft.com/kb/2745294
That worked!

But in the "Attach Data Source Wizard" the Service "refused" to show it self ;-) even after more then 2 minutes.

Because I'am a beginner in LightSwitch I get stucked.

Has this something to do with Visual Studio 12 or am I missing something?

Best regards
Norbert Kramer


Norbert Kramer
KramerDesign

The Netherlands
Michael WashingtonUser is Offline
Send Private Message
Posts:1313
Avatar

--
27 Aug 2012 10:16 PM
Make sure your WCF RIA Service is ASP.NET 4.0 not ASP.NET 4.5
-----------
Michael Washington
http://LightSwitchHelpWebsite.com
Richard WaddellUser is Offline
New Member
New Member
Send Private Message
Posts:14
Avatar

--
27 Aug 2012 10:51 PM
I noticed a warning like this when I had the same problem:

Warning 1 The referenced project 'FAST_WCF' is targeting a higher framework version (4.5) than this project’s current target framework version (4.0). This may lead to build failures if types from assemblies outside this project’s target framework are used by any project in the dependency chain.

It worked after I targeted 4.0

Here's another example:
Norbert KramerUser is Offline
New Member
New Member
Send Private Message
Posts:2
Avatar

--
28 Aug 2012 11:48 PM
Hi Michael,
I got it working. I had to reinstall Visual Studio 12. Apperently there where some instalation errors.

Thanxs for your help.
Norbert Kramer
KramerDesign

The Netherlands
svetoslav80User is Offline
New Member
New Member
Send Private Message
Posts:6
Avatar

--
19 Oct 2012 05:43 PM
There's a similar question above, but is there a reason not to use the "wcf ria services class library" project, instead of just "class library" project, as shown here?
Edit: I just noticed the article is more than an year old, maybe the old version of VS didn't have this project type
Michael WashingtonUser is Offline
Send Private Message
Posts:1313
Avatar

--
19 Oct 2012 10:15 PM
This is the method that works.
-----------
Michael Washington
http://LightSwitchHelpWebsite.com
heckj516User is Offline
New Member
New Member
Send Private Message
Posts:2
Avatar

--
11 Dec 2012 08:17 AM
Michael,

Thanks for writing on this topic.

I followed your procedure, but initially had trouble creating the domain service class due to an apparent change in the way VS2012 (versus VS2010) creates and processes the "Add New Domain Service Class" form. Initially, this form does not "automatically" populate with the tables, views,etc. which were selected during creation of the "*.edmx" model. It took me two days and a lot of "Googling" until I happened to notice and track-down the meaning of the following message displayed in the form, "Some Entity Framework context classes may have been excluded". By clicking on a link presented on the form, I was led to Microsoft support, http://support.microsoft.com/kb/2745294. As soon as I followed the "work around" documented there, the domain service was created by the wizard with all the appropriate assembly references, code, etc. The solution apparently then built with no warnings or errors.

However, I now have the following problem: When attempting to add the RIA service as a data source for my Lightswithch app, the RIA service is clearly visible in the Projects Tab of the "Add Reference" form, when I select the desired RIA service and depress the "OK" button the selected RIA service is not displayed in the "Available WCF Ria Service Classes" form. I waited for 15 - 30 minutes for this form to populate. Any ideas?

Thanks again for your post. Also, I bought both your OData and controls books.
You are not authorized to post a reply.
Page 2 of 3 << < 123 > >>


Microsoft Visual Studio is a registered trademark of Microsoft Corporation / LightSwitch is a registered trademark of Microsoft Corporation