简体   繁体   English

Silverlight +定制RIA服务

[英]Silverlight + Custom RIA Services

Good day! 美好的一天!

I'm developing a Silverlight Solution with a lot of projects that uses RIA Services. 我正在开发一个包含许多使用RIA服务的项目的Silverlight解决方案。 Each silverlight project have Silverlight + Own Ria Services project. 每个Silverlight项目都有Silverlight + Own Ria Services项目。 I want to make only one RIA services project and all silverlight project consume it. 我只想创建一个RIA服务项目,而所有silverlight项目都将其消耗掉。

The problem is when I set the "WCF RIA Services Link" to the new RIA Services, the Silverlight project works ok, my ViewModel class works ok, but, when I'm running, the application give me the error: "Load operation failed for query 'GetList'. The remote server returned an error: NotFound." 问题是,当我将“ WCF RIA Services Link”设置为新的RIA Services时,Silverlight项目运行正常,ViewModel类运行正常,但是,当我运行时,应用程序给我错误:“加载操作失败查询“ GetList”。远程服务器返回错误:NotFound。

When I test on the browse http://localhost/Project-Web-Services-Patrimonio-ClassService.svc runs ok. 当我在浏览器上测试时, http://localhost/Project-Web-Services-Patrimonio-ClassService.svc运行正常。

How can i do to make it ok? 我该怎么做才能使它正常?

[]'s Tiago Schäffer []的TiagoSchäffer

I think you will find you are missing the RIA services web library config settings in your web app. 我想您会发现您在Web应用程序中缺少RIA服务Web库配置设置。

Taken from my answer here . 从我的答案采取这里 Key notes in bold. 主要注释以粗体显示。

Use the RIA services project option to create your service library. 使用RIA服务项目选项创建服务库。 That creates 2 projects that are bound together (for code gen of the proxy objects). 这将创建2个绑定在一起的项目(用于代理对象的代码生成)。 Both are effectively just libs (1 Silverlight and 1 .Net) 两者实际上都是库(1个Silverlight和1个.Net)

Link any RIA services client library to you Silverlight app. 将任何RIA服务客户端库链接到您的Silverlight应用程序。 Then link the .web RIA project to your hosting web app (for the standard RIA use). 然后,将.web RIA项目链接到您的托管Web应用程序(供标准RIA使用)。 You can also add the .web library to your Wcf service as a .Net lib (not consume it as a service). 您还可以将.web库作为.Net库添加到Wcf服务中(而不是将其作为服务使用)。

If you did not create your main Silverlight project as a RIA services project you will need to move the settings across from the app.config file to your web.config file. 如果您没有将主Silverlight项目创建为RIA服务项目,则需要将设置从app.config文件移至web.config文件。 If you already have the service support settings you only need to copy the db connection string across. 如果已经有了服务支持设置,则只需要复制数据库连接字符串即可。 The db connection string only should be needed for you Wcf project. Wcf项目仅需要db连接字符串。

You should then be able to either use the server-side RIA calls (don't forget to add your own submitchanges calls as RIA does that behind the scenes once per batch of updates), or just use the data layer (EF etc) directly. 然后,您应该能够使用服务器端RIA调用(不要忘记添加您自己的commitchanges调用,就像RIA每批更新在后台进行一次那样),或者直接使用数据层(EF等) 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM