目前我正在构建一个 Silverlight WCF RIA 应用程序。进展顺利,客户毫无问题地获得了所需的数据。然后我决定向数据库中添加一个表,更新关联的实体数据模型 EDMX 文件,并重新生成关联的域服务类。现在它仍然可以毫无问题地获取以前获取的所有表,但是当我尝试从新表 tblProject 获取数据时,我收到此错误:
Error
Load operation failed for query 'GetTblProjects'. The remote server returned an error: NotFound.
Error Details
at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )
Caused by: The remote server returned an error: NotFound.
at System.ServiceModel.DomainServices.Client.WebDomainClient`1.EndQueryCore(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainClient.EndQuery(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
Caused by: The remote server returned an error: NotFound.
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
Caused by: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClassa.<EndGetResponse>b__9(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__0(Object sendState)
我花了很多时间查看域服务类,以及 XAML 代码和关联的视图模型类,并且看不到与可以正常工作的 tblBasin 数据库表相关的实现之间的任何差异没有问题,新的 tblProject 表给了我错误。当我打开 WCF 跟踪时,这是我为 tblBasin 得到的:
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>458758</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2012-04-20T21:54:03.3280726Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{169c9eeb-338f-4ea5-a93a-34f234113283}" />
<Execution ProcessName="WebDev.WebServer40" ProcessID="5276" ThreadID="14" />
<Channel/>
<Computer>WKSTCAL0123</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information">
<TraceIdentifier>http://msdn.microsoft.com/en-CA/library/System.ServiceModel.Security.SecurityImpersonationSuccess.aspx</TraceIdentifier>
<Description>Security Impersonation succeeded at the server.</Description>
<AppDomain>f8f8d82-2-129794323085920534</AppDomain>
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/SecurityImpersonationTraceRecord">
<OperationAction>http://tempuri.org/ProjectSetDomainServicebinary/GetTblBasins</OperationAction>
<OperationName>GetTblBasins</OperationName>
</ExtendedData>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>
这是我为失败的 tblProject 表数据得到的结果:
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>262163</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2012-04-20T21:54:03.3270721Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{30c0de8a-fd38-4ca6-8c8a-b88f27a783bf}" />
<Execution ProcessName="WebDev.WebServer40" ProcessID="5276" ThreadID="12" />
<Channel/>
<Computer>WKSTCAL0123</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information">
<TraceIdentifier>http://msdn.microsoft.com/en- CA/library/System.ServiceModel.Channels.MessageReceived.aspx</TraceIdentifier>
<Description>Received a message over a channel.</Description>
<AppDomain>f8f8d82-2-129794323085920534</AppDomain>
<Source>System.ServiceModel.Activation.HostedHttpContext+HostedHttpInput/61784148</Source>
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/MessageTransmitTraceRecord">
<MessageProperties>
<AllowOutputBatching>False</AllowOutputBatching>
<Via>http://localhost:57671/Services/ZEGApps-Web-Services-ProjectSetDomainService.svc/binary/GetTblProjects</Via>
</MessageProperties>
<MessageHeaders>
<To d4p1:mustUnderstand="1" xmlns:d4p1="http://schemas.microsoft.com/ws/2005/05/envelope/none" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://localhost:57671/Serv ices/ZEGApps-Web-Services-ProjectSetDomainService.svc/binary/GetTblProjects</To>
</MessageHeaders>
</ExtendedData>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>
有人对如何解决此问题有任何建议吗?TIA。
更新:除了从我创建的新 tblProject 数据库表中获取数据的调用之外,所有服务调用都成功。