【问题标题】:Can't clean cache in Edge WebView during Office Add-In Development在 Office 加载项开发期间无法清除 Edge WebView 中的缓存
【发布时间】:2020-02-19 07:34:00
【问题描述】:

现在 Office 加载项使用新的基于 Edge 的 WebView 而不是基于 IE 11 的。从这一刻起,我无法开发任何东西。因为项目的所有文件都不能更改。 Edge WebView 总是使用它们的缓存版本。

我用了很多东西。

<!-- Cache Control-->
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<!-- No results. Absolutely. All content still cached-->

我也尝试了这里的所有东西: Office-js addin with Excel and Edge Webview - how to delete cache?

同样没有成功。

现在我使用两种三种方式进行“开发”。 1. 更改 Manifest.xml 中的起点。每次改变一些东西之后。 2. 在文件*.csproj 和*.cproj.user 中更改解决方案Web 部分的端口。每次尝试更改代码中的内容时,也需要这样做。 3.每次更改后等待明天。是的,它有帮助。

我哪里错了?请帮忙!

更新:我刚刚了解了 WebView2。我敢肯定,就我而言,我通常使用 Edge WebView。

【问题讨论】:

    标签: webview microsoft-edge office-addins


    【解决方案1】:

    更新Office-js addin with Excel and Edge Webview - how to delete cache?

    在我们的例子中,我们使用 Azure 应用服务 (IIS) 作为 Office 插件的后端。 我们添加了以下 web.config 设置,让客户端在每次访问时重新验证所有缓存文件:

    ...
      <system.webServer>
        <staticContent>
          <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="0.00:00:00" cacheControlCustom="must-revalidate" />
        </staticContent>
    ...
    

    当然,cacheControlMaxAge 可以根据您的需要进行调整。

    【讨论】:

    • 是的,它有效!非常感谢。对于我的 IIS Express,我刚刚在 ...Web 项目的根目录中的 Web.Debug.config 结尾之前添加了这些行(在 之前)。现在一切正常!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多