Silverlight 无法与 HTTPS Web 服务通信?
我有一个与 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们想通了。问题归结为跨区域调用:
我们的 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.