Silverlight 4 服务
我在虚拟机上运行 Windows Server 2008,并通过 IIS Web 服务器托管我的 silverlight 应用程序。当我尝试从 localhost:80 上的服务器 (VM) 浏览应用程序时,一切正常并且可以找到服务。但是,当我尝试从网络上的另一台计算机浏览该应用程序时,我可以看到主屏幕,并且 silverlight 加载了所有内容,但是当它调用服务时,我收到一个异常:
SCRIPT5022: Silverlight 应用程序中出现未处理的错误操作,使结果无效。检查 InnerException 以获取异常详细信息。在 System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() 在 alisaWebApp.SecurityService.EncryptCompletedEventArgs.get_Result() 在 alisaWebApp.LoginPage.securityClient_EncryptCompleted(对象发送者,EncryptCompletedEventArgs e) 在 alisaWebApp.SecurityService.SecurityServiceClient.OnEncryptCompleted(Object state)
不太确定这意味着什么,但我的猜测是找不到该服务?但是,不应该从网络服务器调用该服务吗?当我从服务器运行应用程序时,一切正常。也许我缺少端口转发的东西?任何帮助将不胜感激。
I'm running Windows Server 2008 on a virtual box with an IIS webserver hosting my silverlight application. When I try to browse the app from the server (VM) on localhost:80, everything works fine and the services are found. But when I try to browse the app from another computer on the network, I can see the main screen and silverlight loads everything but when it goes to call a service, I get an exception:
SCRIPT5022: Unhandled Error in Silverlight Application An exception occurred during the operation, making the result invalid. Check InnerException for exception details. at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at alisaWebApp.SecurityService.EncryptCompletedEventArgs.get_Result()
at alisaWebApp.LoginPage.securityClient_EncryptCompleted(Object sender, EncryptCompletedEventArgs e)
at alisaWebApp.SecurityService.SecurityServiceClient.OnEncryptCompleted(Object state)
Not too sure what that can mean but my guess is that the service can't be found? But shouldn't the service be called from the web server and when I run the app from the server everything works. Maybe I'm missing something with port forwarding? Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您在 Silverlight 代码中调用该服务,则将从用户浏览器中运行的 Silverlight 应用程序调用该服务。您需要使用 clientaccesspolicy.xml 允许特定 ip 或所有 ip 通过 http 或 https 访问服务。
该文件需要位于 Web 应用程序的根目录中。
您可能还需要设置一些安全性,除非您希望全世界都能够使用您的服务。
另一个问题可能是 ClientConfig 文件。如果当前设置为 localhost(到您的服务器 IP),您需要更改其中的服务端点地址。
The service will be called from the Silverlight app running in the user's browser if you are calling the service in your Silverlight code. You'll need to allow specific ip's or all ip's to access to the service over http or https using a clientaccesspolicy.xml.
This file needs to be in the root directory of the web app.
You'll probably want to setup some security as well, unless you want the whole world to be able to use your service.
The other issue could be the ClientConfig file. You'll need to change the service endpoint address in there if it is currently set to localhost (to your server ip).
您可能会遇到跨域异常。当 SilverLight 应用程序托管在本地主机时,不会强制执行与服务访问相关的安全性。
如果这是正确的,请查看有关 cross 的文章域访问。
You're probably getting a cross domain exception. Security associated with service access is not enforced when the SilverLight application is hosted at localhost.
If this is correct, check out this article on cross domain access.