我有一个使用Entity Framework 4构建的Silverlight应用程序,一堆Silverlight模块和一个包含我的DomainService,Model和Web.Config的Web项目。
我从本地SQL Server中提取数据的工作正常。我的一个SL模块从特定表中提取数据,当此表中有超过4000行时,应用程序崩溃并给出以下错误消息。当它有大约1000个roes它工作得很好。 所以,我想也许DomainService无法处理所有行,或者webconfig中的绑定设置可能在某种程度上是错误的。我该怎么办?
错误消息:
{System.ServiceModel.DomainServices.Client.DomainOperationException:查询'LoadSiteCageData'的加载操作失败。远程服务器返回错误:NotFound。 ---> System.ServiceModel.CommunicationException:远程服务器返回错误:NotFound。 ---> System.Net.WebException:远程服务器返回错误:NotFound。 ---> System.Net.WebException:远程服务器返回错误:NotFound。 在System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) 在System.Net.Browser.BrowserHttpWebRequest。<> c_ DisplayClass5.b _4(Object sendState) 在System.Net.Browser.AsyncHelper。<> c_ DisplayClass4.b _0(Object sendState) ---内部异常堆栈跟踪结束--- 在System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod,Object state) 在System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result) ---内部异常堆栈跟踪结束--- 在System.ServiceModel.DomainServices.Client.WebDomainClient`1.EndQueryCore(IAsyncResult asyncResult) 在System.ServiceModel.DomainServices.Client.DomainClient.EndQuery(IAsyncResult asyncResult) 在System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) ---内部异常堆栈跟踪结束--- 在System.ServiceModel.DomainServices.Client.OperationBase.Complete(异常错误) 在System.ServiceModel.DomainServices.Client.LoadOperation.Complete(异常错误) 在System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) 在System.ServiceModel.DomainServices.Client.DomainContext。<> c_ DisplayClass1b.b _17(Object)
的Web.Config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="system.serviceModel">
<section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" allowDefinition="MachineToApplication" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings />
<system.web>
<httpModules>
<add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpModules>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
</pages>
<authentication mode="Windows" />
</system.web>
<system.codedom></system.codedom>
<system.webServer>
<modules>
<add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="MyService.Web.Service1.customBinding0">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
<services>
<service name="MyService.Web.Service1">
<endpoint address="" binding="customBinding" bindingConfiguration="MyService.Web.Service1.customBinding0" contract="MyService.Web.Service1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
答案 0 :(得分:1)
我认为这是因为只要涉及basichttpbinding,就可以通过线路获得数据的大小限制。它是64k。
有两种方法可以解决这个问题。
我通常做的是将数据下载为zip文件,在客户端解压缩,然后处理如此大量的数据。