Silverlight 无法与 HTTPS Web 服务通信?

发布于 2024-09-14 05:36:15 字数 673 浏览 1 评论 0原文

我有一个与 HTTPS Web 服务通信的 Silverlight 应用程序。

在大多数机器上它工作正常,但是在某些机器上它始终失败。

在它失败的计算机上,我在向 HTTPS Web 服务发出 WebClient 请求时收到 SecurityException。 SecurityException 本身并没有给我任何关于它为什么失败的线索:

WebClient client = ...;
client.DownloadStringCompleted += OnCompleted;
client.DownloadStringAsyc("https://somewebservice/foo");

...

void OnCompleted(object sender, DownloadStringCompletedEventArgs e)
{
    Console.WriteLine(e.Error); // Prints SecurityException. Message = "Security error"
}

What are the possible Reasons a Silverlight app will failed to call an HTTPS Web service?我该如何调试这个?

编辑仍然没有答案——我可以提供任何其他信息来帮助解决这个问题吗?

I've got a Silverlight app that talks to an HTTPS web service.

On most machines it works fine, however, on some machines it fails consistently.

On the machines it fails on, I receive a SecurityException when making a WebClient request to the HTTPS web service. The SecurityException itself doesn't give me any clues as to why it's really failing:

WebClient client = ...;
client.DownloadStringCompleted += OnCompleted;
client.DownloadStringAsyc("https://somewebservice/foo");

...

void OnCompleted(object sender, DownloadStringCompletedEventArgs e)
{
    Console.WriteLine(e.Error); // Prints SecurityException. Message = "Security error"
}

What are the possible reasons a Silverlight app will fail to call an HTTPS web service? How can I go about debugging this?

edit Still no answers -- is there any additional info I can give to help solve this problem?

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

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

发布评论

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

评论(1

别闹i 2024-09-21 05:36:15

我们想通了。问题归结为跨区域调用:

我们的 Silverlight 应用程序托管在 foo.bar.com 上,该网站位于 IE 的常规 Internet 区域(低信任度)。

我们的 Web 服务托管在 foo.ourcompany.com 上,该网站位于 IE 的 Intranet 区域(高度信任)。

Silverlight 应用程序无法从低安全区域向高安全区域发出 Web 请求调用。请参阅 MSDN 有关 Silverlight URL 访问限制的文章更多信息。在我们的例子中,从 Internet->Intranet 是从低信任到高信任,因此 SL 调用失败并出现 SecurityException。

意见:Microsoft 应该提供有关 Web 请求调用期间发生 SecurityException 的原因的信息。这本来可以节省我们很多时间和金钱。

We figured it out. The problem came down to cross-zone calls:

Our Silverlight app was hosted on foo.bar.com, which is in IE's regular Internet Zone (low trust).

Our web service was hosted on foo.ourcompany.com, which is in IE's Intranet Zone (high trust).

Silverlight apps cannot make web request calls from low security zones to higher security zones. See MSDN's article on Silverlight URL Access Restrictions for more information. In our case, going from Internet->Intranet was going from low trust to high trust, and so SL call failed with a SecurityException.

Opinion: Microsoft should provide information about why a SecurityException occurred during web request calls. This would have saved us much time and money.

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