除非 Silverlight 项目托管在同一项目中,否则对 Web 服务的调用将会失败

发布于 2024-11-08 23:02:37 字数 455 浏览 0 评论 0 原文

我正在打开一些较旧的演示代码,并在开始调试会话时收到以下消息:

"The Silverlight project you are about to debug uses web services.  Calls to the 
web service will fail unless the silverlight project is hosted in and launched 
from the same web project that contains the web services."

我正在 Visual Studio 2010 中工作,并且项目已配置为 .NET 4.0。有一个托管 xap 文件的 Web 项目和一个构建 xap 的 Silverlight 项目。 Silverlight 项目有一个对公开股票报价服务的服务引用。

我的问题:上述警告是什么意思(通俗地说)以及如何解决?

I am opening some older demo code and received the following message when I started a debugging session:

"The Silverlight project you are about to debug uses web services.  Calls to the 
web service will fail unless the silverlight project is hosted in and launched 
from the same web project that contains the web services."

I am working in Visual Studio 2010, and the projects are configured for .NET 4.0. There is a web project which hosts the xap file and a Silverlight project which builds the xap. The Silverlight project has a service reference to a publicly available stock quote service.

My question: What does the above warning mean (in layman's terms) and how do I resolve it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

伤感在游骋 2024-11-15 23:02:37

我认为,如果您将托管 Silverlight 应用程序的 Web 项目设置为启动项目(在解决方案资源管理器中右键单击该项目并选择“设置为启动项目”),这种情况就会消失。

I think this will go away if you set the web project which hosts the Silverlight application to be your startup project (right-click on the project in the Solution Explorer and select "Set as Startup Project").

隐诗 2024-11-15 23:02:37

默认情况下,Silverlight 只能调用下载 XAP 的同一域中托管的服务,或者调用明确允许来自其他域的调用者进行此调用的服务 - 请参阅 http://msdn.microsoft.com/en-us/library/cc197955%28VS.95%29.aspx 了解更多信息。既然您说您正在调用一个公开可用的服务(我假设您不拥有它),那么这些调用要么会正常工作(如果该服务允许跨域调用),要么会失败(如果不允许) 't)。

Silverlight by default can only make calls either to services hosted on the same domain where the XAP was downloaded, or to services which explicitly allow callers from other domains to make this call - see http://msdn.microsoft.com/en-us/library/cc197955%28VS.95%29.aspx for more information on that. Since you say you're calling a publicly available service (I'm assuming you don't own it), then either the calls will just work (if the service allows cross-domain calls), or they will fail (if it doesn't).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文