[英]Why I don't see DLLs and dotnet.wasm being loaded on a Blazor WebAssembly app in Browser > Dev Tools > Network?
I am fiddling with the default VS2019 (16.6.5) Blazor WebAssembly project.我正在摆弄默认的 VS2019 (16.6.5) Blazor WebAssembly 项目。 However when I look at Chrome (or Firefox or Edge) > Developer Tools [F12] >.network , with Disable Cache enabled, I don't see much being loaded?
但是,当我查看Chrome(或 Firefox 或 Edge)> Developer Tools [F12] >.network时,启用Disable Cache时,我没有看到太多加载?
In the Dev Tool > Sources I can see that do.net.wasm has been loaded somehow.在Dev Tool > Sources中,我可以看到do.net.wasm已以某种方式加载。
And by reading some articles like this one I see screenshots that show DLL and wasm being loaded.通过阅读一些像这篇文章这样的文章,我看到了显示 DLL 和正在加载的 wasm 的屏幕截图。
Why don't I see that?为什么我看不到?
Edit: Ok I succeed to see DLLs loaded like I want only when starting debugging the Blazor WebAssembly project from VS2019 .编辑:好的,只有在从 VS2019 开始调试 Blazor WebAssembly 项目时,我才成功看到按我想要的方式加载的 DLL。 When I start the project without debugging, I still get the same lightweight load as in the first screenshot.
当我在没有调试的情况下启动项目时,我仍然得到与第一个屏幕截图相同的轻量级负载。 Why?
为什么?
Blazor WASM changed the loading behaviour just before RTM version 3.2 was released (May 2020) so the examples prior to this demonstrate the old behaviour. Blazor WASM 在 RTM 版本 3.2 发布之前(2020 年 5 月)更改了加载行为,因此在此之前的示例演示了旧行为。
When a Blazor WASM application loads, it creates a manifest and checksum for each DLL, this is loaded in blazor.boot.json
当加载 Blazor WASM 应用程序时,它会为每个 DLL 创建一个清单和校验和,它加载在
blazor.boot.json
The Blazor code will check for these files (and the checksum) in the Browser's Cache storage. Blazor 代码将检查浏览器缓存存储中的这些文件(和校验和)。 Note this is not the same cache the browser uses for normal content, eg HTML, CSS etc.
请注意,这与浏览器用于普通内容的缓存不同,例如 HTML、CSS 等。
If they're not present (the first run) they are loaded.如果它们不存在(第一次运行),它们将被加载。 You can see the files that were loaded here:
您可以在此处查看加载的文件:
These files are loaded on the first run.这些文件在第一次运行时加载。 In future page views, if the filename and checksum matches, it won't be reloaded even if you select the browser's "Empty Cache and Hard Reload"
在以后的页面视图中,如果文件名和校验和匹配,即使您 select 浏览器的“清空缓存和硬重新加载”也不会重新加载
Why?为什么? This makes sense because files like
mscorlib.dll
won't have changed due to an app recompiling.这是有道理的,因为像
mscorlib.dll
这样的文件不会因为应用程序重新编译而改变。 This isn't JavaScript, it's a binary.这不是 JavaScript,而是二进制。 The SHA256 checksum verifies it's the same file.
SHA256 校验和验证它是同一个文件。
However your Blazor app DLLs will change if you edit and recompile.但是,如果您编辑并重新编译,您的 Blazor 应用程序 DLL 将会更改。 If they do they get reloaded:
如果他们这样做,他们会重新加载:
If you want to force a full reload, you can navigate to the Browsers Cache (under Application in Chrome developer tools), and select Delete for your site.如果你想强制完全重新加载,你可以导航到浏览器缓存(在 Chrome 开发者工具中的应用程序下),然后为你的网站删除 select。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.