3

我有一个与 HTTPS 网络服务对话的 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"
}

Silverlight 应用程序无法调用 HTTPS Web 服务的可能原因有哪些?我该如何调试呢?

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

4

1 回答 1

3

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

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

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

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

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

于 2010-08-17T15:46:50.760 回答