更新后强制浏览器重新加载 Silverlight xap
我有一个 Silverlight 控件,已打包并部署到 SharePoint Web 部件。推送更新后,浏览器加载新版本的控件时遇到问题。我正在更新我的 xap 项目的程序集和文件版本,但这似乎并不重要。让浏览器加载新 xap 的唯一方法是进入并删除临时 Internet 文件。对我来说,在开发过程中,这没问题,但我需要在投入生产之前找到解决方案。有什么想法吗?
I have a Silverlight control packaged up and deployed to a SharePoint web part. I'm having trouble with the browser loading new versions of the control after I push an update. I'm updating the assembly and file version of my xap project, but it doesn't seem to matter. The only way to get the browser to load the new xap is to go in and delete temporary Internet files. For me, during development, that's OK, but I'll need to find a solution before it's time for production. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这与您的浏览器处理资源请求的方式有关。 Flash 也有类似的问题,并且有一些解决方法。
这是一篇文章,详细介绍了该问题和可能的解决方案。
我建议做这样的事情:
假设你的 html 中的 xap 有这个:
我会对它进行版本控制,因此每当你执行推送时,你都会更改版本号。例子:
This has to do with how your browser handles resource requests. Flash has similar issues and there are a couple workarounds.
Here's an article that details the issue and possible solutions.
I would suggest doing something like this:
Say you have this for your xap in your html:
I would version it so whenever you do a push you change the version number. Example:
伟大的!甚至还从事 Windows Phone 开发工作。
我添加了以下行:
然后重写方法
OnNavigedTo
:Great! Worked even in Windows Phone development.
I've put the line:
And then Override the method
OnNavigatedTo
:遇到 .XAP 缓存的情况并不少见,这意味着每次部署新版本的 Silverlight 应用程序时,浏览器都不会下载更新的 .XAP 文件。
一种解决方案是更改 IIS 属性。您可以按照以下步骤为您的 .XAP 文件打开“启用内容过期 HTTP 标头”选项:
这样,当您刷新页面时,将下载最新的 .XAP(仅当有最新的 .XAP 文件时),而无需关闭浏览器。
希望这有帮助!
t’s not very uncommon to run into .XAP caching, which means that every time you deploy a new version of the Silverlight application, the browser does not download the updated .XAP file.
One solution could be to change the IIS properties. You can turn the “Enable Content Expiration HTTP header” option on for your .XAP file by following these step:
This way the latest .XAP (only if there is a latest .XAP file) will get downloaded when you refresh your page without having to close the browser.
Hope this helps!
将以下 web.config 放入 ClientBin
put the following web.config into ClientBin
这里提到的解决方案和其他帖子始终没有帮助我。
我最终所做的是将 .xap 和 .svc 文件从我的 Release 版本手动复制到 ClientBin 和 Service 部署文件夹中。
The solutions mentioned here and other posts did not help me, consistently.
What I did in the end was manually copy the .xap and the .svc files from my Release build to the ClientBin and Service deployment folders, respectively.