无法在Windows XP计算机上开发WCF RIA服务
我创建了一个简单的 Silverlight 插件,它调用 WCF RIA 服务来检索数据。当在 Windows 7 机器上开发并在 VS2010 Cassini 环境中运行时,这工作得很好。
然而,在我的笔记本电脑(一台装有 IIS 5.1 的 Windows XP 计算机)上运行我的应用程序时,每次我从 Cassini 或托管 IIS 中的 Silverlight 插件调用该服务时都会出现错误:
System.ServiceModel.DomainServices.Client.DomainOperationException:查询“GetInfo”的加载操作失败。远程服务器返回错误: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(对象 sendState) 在 System.Net.Browser.AsyncHelper.<>c_DisplayClass4.b_1(对象 sendState) --- 内部异常堆栈跟踪结束 --- 在 System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod,对象状态) 在 System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 在 System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult 结果) --- 内部异常堆栈跟踪结束 --- 在 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.Exception
如何在 Windows XP 上创建 Silverlight 和 RIA 服务环境?
环境:
Windows XP
Visual Studio 2010
.NET Framework 4
查询大约需要 7 秒才能返回错误
RIA Services SDK 安装了
RIA Services Toolkit 安装了
Silverlight Developer Runtime
安装了 Silverlight 4 SDK
I have created a simple Silverlight Plugin that makes a call to a WCF RIA Service to retrieve data. This works fine when developing on a Windows 7 machine and running it in the VS2010 Cassini environment.
However, running my application on my laptop computer, a Windows XP machine with IIS 5.1, causes me to get an error every time I call the service from my Silverlight Plugin either in Cassini or in hosted IIS:
System.ServiceModel.DomainServices.Client.DomainOperationException: Load operation failed for query 'GetInfo'. The remote server returned an error: NotFound. ---> System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c_DisplayClass5.b_4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c_DisplayClass4.b_1(Object sendState)
--- End of inner exception stack trace ---
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)
--- End of inner exception stack trace ---
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)
--- End of inner exception stack trace ---} System.Exception
How can I make my Silverlight and RIA Services environment on Windows XP?
Environment:
Windows XP
Visual Studio 2010
.NET Framework 4
The query takes about 7 seconds to return an error
RIA Services SDK installed
RIA Services Toolkit installed
Silverlight Developer Runtime installed
Silverlight 4 SDK installed
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经解决了这个问题,但我无法确定为什么该服务在我的 Windows 7 计算机上运行。
问题是我在服务中检索的 Linq to Sql 类之一中伪造了外键关系。基本上,我将 Linq to Sql 类扩展为具有一个基于非官方外键值获取子记录的属性。当我的 Silverlight 应用程序尝试从服务加载父对象时,在引用我创建的扩展属性时出现错误。
通过修改扩展属性,使其不会对数据库进行新的调用,我能够成功使用该服务。
提示我可能需要更改代码的是我在 Visual Studio 错误列表中看到的一条警告消息。
I have resolved this issue but I have not been able to determine why this service worked on my Windows 7 machine.
The problem was that I was faking a foreign key relationship in one of my Linq to Sql classes that I was retrieving in the service. Basically, I had extended the Linq to Sql class to have a property that fetched child records based on the unofficial foreign key value. When my Silverlight application tried to load the parent object from the service, it gave an error when referencing the extended property that I created.
By modifying the extension property so that it did not make a new call to the database I was able to successfully use the service.
What gave me a tip that I might have to change my code was a Warning message that I saw in my Visual Studio error list.