I made one application in silverlight4 and used EDM and WCF-RIA for database access.
Now I want to integrate this application to asp.net project and when I integrate it into the ASP.net project it is giving this exception-
Microsoft JScript runtime error: Unhandled Error in Silverlight Application Load operation failed for query 'GetQuestions'. The remote server returned an error: NotFound. at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error) at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error) at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) at System.ServiceModel.DomainServices.Client.DomainContext.<>c_DisplayClass1b.b_17(Object )
so please help me anybody.
Your RIA Services DomainService has 2 parts. You have copied the client part by virtue of copying the XAP file, but you are missing the RIA WCF server-side part of the service.
You need to move the Domain service files from your original Silverlight website to your new ASP.Net project (along with any web.config settings required to wire it up properly). This is not in the ASPX files. Without seeing the specifics of your existing projects I can't tell you exactly what filenames you need to migrate.
My suggestion is to always create RIA Service libraries instead of adding directly to a Silverlight application. Then you can link the Client-side library to any number of Silverlight applications, then link the .Web part of the RIA library to your website to provide the WCF service. Again the key is to migrate the config settings.
It will probably make a lot more sense if you create a new RIA services library project, add your EDM etc, then link the halves to a separate Silverlight app and your new ASP.net website.
RiaServices.web
project. Select Add new item. Select Data on the left. Select ADO.Net Entity Data Model on the right. I will assume it is called the default Model1.edmx
for this example. Connect it to your database tables etc.RiaServices.web
project. Select Add new item. Select Web on the left. Select Domain Service Class on the right. I will assume it is called DomainService1.cs
for this example. Choose your data items from the Add New Domain Service Class popup window by ticking the checkboxes. A set of RIA services objects and methods will be created for each item you select.Use the RIAServicesLibrary1
client object (called DomainService1 in this example) directly from your Silverlight code like this:
DomainService1 client = new DomainService1();
or use the Data Sources
window to drag/drop a new grid etc onto a page.
If the Data Sources
window is not visible select the "Data" menu then the "Show Data Sources" option.
For more information try this Microsoft link: Using WCF RIA Services