Silverlight:处理此请求时发生错误 - System.Data.Services.Client.DataServiceQueryException [英] Silverlight: An error occurred while processing this request - System.Data.Services.Client.DataServiceQueryException

查看:80
本文介绍了Silverlight:处理此请求时发生错误 - System.Data.Services.Client.DataServiceQueryException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的公司,我们使用IBM filenet,并编写了自己的Linq To FileNet提供程序,我通过WCF数据服务访问该提供程序。一切运行良好,直到它在某些计算机上失败,所有计算机都在同一个域,但他们有不同的安全策略 - 可能是
这是问题。


这个问题很奇怪,因为Silverlight提供了例外,但我通过Web浏览器成功浏览并从服务中获取数据 - 包括IE6和Mozilla Firefox。我有另一个使用Linq To Entity的数据服务,但运行正常。


 


例外是:


消息: 处理此请求时发生错误。


异常:  System.Data.Services.Client.DataServiceQueryException


Stack Trace:


 


在System.Data.Services.Client.QueryResult.EndExecute [TElement](对象来源, IAsyncResult asyncResult)    


在System.Data.Services.Client.DataServiceRequest.EndExecute [TElement](对象源,DataServiceContext上下文,IAsyncResult asyncResult)   


------这是我的电话:


在ContractManagementContent.Views.PendingContracts。<> c__DisplayClass1。< LoadUnIndexed> b__0(IAsyncResult ar)


 


------------------- -------------------------------------------------- -------------------------------------------------- ----------------------------------


内部异常:  System.Data.Services.Client.DataServiceClientException


内部异常堆栈跟踪:


在System.Data.Services.Client.BaseAsyncResult.EndExecute [T ](对象源,String方法,IAsyncResult asyncResult) 在System.Data.Services.Client.QueryResult.EndExecute [TElement](对象来源,IAsyncResult asyncResult)


 


两种数据服务之间配置的唯一区别是,有问题的,有一个有更大的maxBufferSize和  maxReceivedMessageSize?


 


这不是一个安全例外,我甚至从不同的域成功使用该服务。


我在服务器上添加调试消息,程序没有点击它们,失败在客户端。


在所有计算机上,我们使用Silverlight 4的最新版本。


你能给我一个调查的起点吗? / p>

解决方案

我认为这是一个错误的机会,我写了一个使用javascript的解决方法:


 


 
< 脚本 src = " Scripts / Start.js" type = < span style ="color:Blue;">" text / javascript" > < / script >
< 脚本 类型 = " text / javascript" >

Sys.require([Sys.components.dataView,Sys.components.openDataContext,Sys.components.openDataServiceProxy]);
function ConsumeDataService(url,query){
var service = < span style ="color:Blue;"> new Sys.Data.OpenDataServiceProxy(url);
service.query(query,OnSuccess,OnFailed);

}

函数 OnSuccess(结果,上下文,操作,userContext){
var silverlightApp = document.getElementById(" SilverlightObject" );
silverlightApp.Content.SilverlightApp.SuccessGetData(result);
}

function OnFailed(错误,上下文,操作){
var silverlightApp = document.getElementById(" SilverlightObject" );
silverlightApp.Content.SilverlightApp.FailedGetData(error);
}
< / script >


In my company we use IBM filenet and I wrote my own Linq To FileNet provider that I access through WCF data services. Everything runs fine until it fails on some computers, all computers are in same domain but they have different security polices - maybe this is the problem.

The problem is very strange because the Silverlight gives the exception, but I successfully browse and get data from the service through the web browser - both IE6 and Mozilla Firefox. I have another data service that uses Linq To Entity but It runs fine.

 

The exception is :

The Message: An error occurred while processing this request.

The Exception : System.Data.Services.Client.DataServiceQueryException

The Stack Trace:

 

at System.Data.Services.Client.QueryResult.EndExecute[TElement](Object source, IAsyncResult asyncResult)     

at System.Data.Services.Client.DataServiceRequest.EndExecute[TElement](Object source, DataServiceContext context, IAsyncResult asyncResult)    

------ This is my call :

at ContractManagementContent.Views.PendingContracts.<>c__DisplayClass1.<LoadUnIndexed>b__0(IAsyncResult ar)

 

---------------------------------------------------------------------------------------------------------------------------------------------------------

Inner Exception: System.Data.Services.Client.DataServiceClientException

Inner Exception Stack Trace:

at System.Data.Services.Client.BaseAsyncResult.EndExecute[T](Object source, String method, IAsyncResult asyncResult)    

at System.Data.Services.Client.QueryResult.EndExecute[TElement](Object source, IAsyncResult asyncResult)

 

The only difference in configuration between the both data services is that problematic one has greater maxBufferSize and maxReceivedMessageSize?

 

It is not a security exception, I successfully consume the service even from different domain.

I add debug messages on server and the program do not hit them, the fail is in the client.

On all computers we use latest version of Silverlight 4.

Can you give me a start point for investigation ?

解决方案

I think that there is a chance that this is a bug, I wrote a workaround that uses a javascript:

 

  <script src="Scripts/Start.js" type="text/javascript"></script>
  <script type="text/javascript">

    Sys.require([Sys.components.dataView, Sys.components.openDataContext, Sys.components.openDataServiceProxy]);
    function ConsumeDataService(url, query) {
      var service = new Sys.Data.OpenDataServiceProxy(url);
      service.query(query, OnSuccess, OnFailed); 
      
    }

    function OnSuccess(result, context, operation, userContext) {
      var silverlightApp = document.getElementById("SilverlightObject");
      silverlightApp.Content.SilverlightApp.SuccessGetData(result);
    }

    function OnFailed(error, context, operation) {
      var silverlightApp = document.getElementById("SilverlightObject");
      silverlightApp.Content.SilverlightApp.FailedGetData(error);
    }
  </script>


这篇关于Silverlight:处理此请求时发生错误 - System.Data.Services.Client.DataServiceQueryException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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