Silverlight 4.0 + MVC 2.0 + WCF RIA Services + EF 4.0 =加载错误 [英] Silverlight 4.0 + MVC 2.0 + WCF RIA Services + EF 4.0 = Load Error

查看:221
本文介绍了Silverlight 4.0 + MVC 2.0 + WCF RIA Services + EF 4.0 =加载错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




  • VS 2010(更新的WCF RIA服务)

  • Silverlight 4.0(随WCF RIA服务一起打包)

  • MVC 2

  • EF 4.0



我正在设置它,以便面向公众的页面将是MVC的html,但管理部分将是使用WCF RIA服务的Silverlight导航应用程序数据访问。



当我在Webforms应用程序中创建silverlight应用程序时,它可以工作(我可以添加一个datagrid并使用EF 4.0和WCF RIA服务成功检索数据):
alt text http://www.patleague.com/images/sl4_webforms。 png



当我在MVC2应用程序中创建silverlight应用程序时:
alt text http://www.patl eague.com/images/sl4_mvc2.png



我收到如下错误(我在这两种情况下添加了相同的数据网格 - 一个简单的表格, 2条记录):
alt text http://www.patleague.com/images/ sl4_mvc_dataerr.png



Webforms服务器端在MVC服务器端没有工作。我没有成功尝试WCF日志记录以及fiddler,但是我以某种方式无法获得任何输出(使用示例: http://msdn.microsoft.com/en-us/library/ms730064.aspx ),而且我也尝试过提示,获取一些没有运气的信息。我真的很努力,我想知道有没有人遇到这个问题,找到了一个办法?



谢谢,丹尼斯

解决方案

这个问题可能与我的网站有关,可能其他人也有同样的问题,我已经对此感到沮丧,有一段时间,尝试其他方法来完成我想要的,但是回到了Silverlight,因为我很难用Javascript和JS UI库。当在部署的站点上工作时,我更喜欢fiddler(在使用开发服务器时没有得到任何输出)。



当我浏览到我的网站时silverlight应用程序,对话框弹出与通常的加载操作失败的查询...,并提示显示以下突出显示错误:


IIS指定的认证方案'Basic,Anonymous',但绑定只支持一个认证方案的规范。有效的认证方案是Digest,Negotiate,NTLM,Basic或Anonymous。更改IIS设置,以便只使用一个身份验证方案。


我在DiscountASP.net中查找了这个错误(我的主机提供者),并找到一个知识库文章,指示我更新web.config(对于IIS7),如下所示:

 <系统.webServer> 
< security>
< authentication>
< basicAuthentication enabled =false/>
< / authentication>
< / security>
< /system.webServer>

和中提琴!我可以使用WCF RIA服务与Silverlight在asp.net MVC2!我还发现,在研究这些东西时,我不需要创建一个特殊的服务和一个domainhostfactory,如几篇博文中所述,或者改变路由以避免与MVC和服务请求的交互。这就是我所要做的一切。



我想这是一个非常基本的修复,希望能帮助别人。我对此感到非常沮丧,并且不满意这样一个简单的修复程序是公开的,但是由于这是使用最新的微软技术,因此Microsoft不提供此方案的逐步说明。



谢谢,丹尼斯


I'm trying to buid a site with the following:

  • VS 2010 (for the updated WCF RIA Services)
  • Silverlight 4.0 (packaged with WCF RIA Services).
  • MVC 2
  • EF 4.0

I am setting it up so that the public facing pages will be html from MVC, but the administration portion will be a silverlight navigation application using using WCF RIA Services for data access.

When I create the silverlight application within a webforms application, it works (I am able to add a datagrid and retrieve data using EF 4.0 and WCF RIA Services successfully): alt text http://www.patleague.com/images/sl4_webforms.png

When I create the silverlight application within an MVC2 application: alt text http://www.patleague.com/images/sl4_mvc2.png

I get an error as follows (I've added the same datagrid in both cases - a simple table with 2 records): alt text http://www.patleague.com/images/sl4_mvc_dataerr.png

The webforms server-side works while the MVC server side doesn't. I've unsuccessfully tried WCF logging as well as fiddler, but I somehow can't get any output (using the example here: http://msdn.microsoft.com/en-us/library/ms730064.aspx), and I've also tried fiddler to get some information with no luck. I'm really struggling with this and I wonder if anyone else has run into this issue and found a way around it?

Thanks, Dennis

解决方案

This issue might be specific to my site, but perhaps other people are having the same issue, and I had been so darn frustrated by this that I had given up for a while and tried other methods to get done what I wanted, but came back to Silverlight because I have a hard time with Javascript and JS UI libraries. I had better luck with fiddler when working on the deployed site (I didn't get any output when working with the development server).

When I browsed to my site with the silverlight app, the dialog popped up with the usual "load operation failed for query...", and fiddler showed the following when highlighting the error:

IIS specified authentication schemes 'Basic, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used.

I looked up this error in the DiscountASP.net (my hosting provider) and found a KB article that instructed me to update the web.config (for IIS7) as follows:

<system.webServer>
  <security>
    <authentication>
      <basicAuthentication enabled="false" />
    </authentication>
  </security>
</system.webServer>

And viola! I could use WCF RIA Services with Silverlight in asp.net MVC2! I found also that it was unnecessary for me to create a special service and a domainhostfactory as described in several blog posts while researching this stuff, or change the routing to avoid interactions with MVC and the service request. This is all I had to do

I guess this is a pretty basic fix, and hopefully it'll help someone else. I was extremely frustrated with this, and dissapointed that such a simple fix is publicly available, yet no step-by-step instructions for this scenario is given from Microsoft as this is using the most up-to-date microsoft technologies.

Thanks, Dennis

这篇关于Silverlight 4.0 + MVC 2.0 + WCF RIA Services + EF 4.0 =加载错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆