none
Load Operation Failed for Query 'GetXXX'错误是由什么引起的? RRS feed

  • 问题

  • SL 4 Business Application, EF+RIA的应用,应用干脆也没什么可说的,就是简简单单地把一个数据库表显示在DataGrid上。也就是很多介绍RIA Service的视频里经常能看到的,把Data Source面板上XXXContext下的表拖到设计界面自动生成DomainDataSource和DataGrid的一个简单的不能再简单的应用。

    用vs2010测试时完全没问题,但发布到win03 Server IIS的虚拟目录下再访问时就出现Load Operation Failed for Query 'GetXXX'错误。

     

     

    BAIDU/BING了好几个小时也没能解决问题。什么添加.xaml和.xap和MIME类型,虚拟目录设置成应用程序等等都试过了。

     

     

    2010年8月10日 3:15

答案

  • 通宵了一个晚上,最终发现原来是IIS里不能同时启用[Forms 身份验证]和[Windows身份验证]或[基本身份验证]引起的。

    就是说把[Windows身份验证]和[基本身份验证]禁用,启用[Forms身份验证], 所有恼人的错误提示全没了,OK!(家里的Win7+IIS 7.5下,单位的Win03+IIS6还没试)

    参考:http://blogs.msdn.com/b/saurabh/archive/2010/03/16/ria-services-application-deployment.aspx

     

    Configuring IIS

     

    RIA Services supports IIS6/IIS7 deployments.

    However WCF (and by association RIA Services) has a limitation that it does not support MultipleAuthenticationSchemas enabled in IIS.

    So if you are using Forms Authentication in your application (if you built your application using the Business Application template, Forms Auth is the default there) you need to make sure that for the IIS VirtualRoot that hosts your WebApp Forms Auth is enabled. Forms Auth + Anonymous will also work fine but Forms Auth + Integrated Auth is not supported.

    Similarly if you are using Windows Authentication in your application (for a default Web Application no Authentication Mode is specified in the Web Config and the default Authentication Mode  is Windows) you need to make sure that for your WebApp only Integrated Auth enabled.

    If you do not have access to your servers IIS settings (most hosters will give you an option to choose the Authentication Mode for your Web Application) you will need to work with your Server Administrator to get those changed.

    I talk later about detecting whether IIS is configured correctly for your Web application.

    (今天上班后设置win03的II6时发现和Win7的IIS7.5还是有点不一样的。[目录安全性]的[启用匿名访问]和[集成Windows身份验证]同时打勾也没问题。)

     

    对了,这篇文章里提到的System.ServiceModel.DomainServices.EntityFramework,System.ServiceModel.DomainServices.Hosting,System.ServiceModel.DomainServices.Server三个设为Copy Local>True也是必须的。

    另外SL 4 Business App默认就启用了Membership, Role等,所以如果想在指定的数据库里存储Membership等信息,那可能需要配置一下web.config。

     

     

     

     

     

     

     

    2010年8月10日 22:42

全部回复

  • NotFound还是因为WCF Service没有成功造成的。推荐使用Fiddler查看一下HTTP返回错误信息。

     

    2010年8月10日 20:37
  • 通宵了一个晚上,最终发现原来是IIS里不能同时启用[Forms 身份验证]和[Windows身份验证]或[基本身份验证]引起的。

    就是说把[Windows身份验证]和[基本身份验证]禁用,启用[Forms身份验证], 所有恼人的错误提示全没了,OK!(家里的Win7+IIS 7.5下,单位的Win03+IIS6还没试)

    参考:http://blogs.msdn.com/b/saurabh/archive/2010/03/16/ria-services-application-deployment.aspx

     

    Configuring IIS

     

    RIA Services supports IIS6/IIS7 deployments.

    However WCF (and by association RIA Services) has a limitation that it does not support MultipleAuthenticationSchemas enabled in IIS.

    So if you are using Forms Authentication in your application (if you built your application using the Business Application template, Forms Auth is the default there) you need to make sure that for the IIS VirtualRoot that hosts your WebApp Forms Auth is enabled. Forms Auth + Anonymous will also work fine but Forms Auth + Integrated Auth is not supported.

    Similarly if you are using Windows Authentication in your application (for a default Web Application no Authentication Mode is specified in the Web Config and the default Authentication Mode  is Windows) you need to make sure that for your WebApp only Integrated Auth enabled.

    If you do not have access to your servers IIS settings (most hosters will give you an option to choose the Authentication Mode for your Web Application) you will need to work with your Server Administrator to get those changed.

    I talk later about detecting whether IIS is configured correctly for your Web application.

    (今天上班后设置win03的II6时发现和Win7的IIS7.5还是有点不一样的。[目录安全性]的[启用匿名访问]和[集成Windows身份验证]同时打勾也没问题。)

     

    对了,这篇文章里提到的System.ServiceModel.DomainServices.EntityFramework,System.ServiceModel.DomainServices.Hosting,System.ServiceModel.DomainServices.Server三个设为Copy Local>True也是必须的。

    另外SL 4 Business App默认就启用了Membership, Role等,所以如果想在指定的数据库里存储Membership等信息,那可能需要配置一下web.config。

     

     

     

     

     

     

     

    2010年8月10日 22:42