简体   繁体   English

为什么我在浏览器 > 开发工具 > 网络中看不到 DLL 和 do.net.wasm 被加载到 Blazor WebAssembly 应用程序上?

[英]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时,我没有看到太多加载?

Blazor wasm

In the Dev Tool > Sources I can see that do.net.wasm has been loaded somehow.Dev Tool > Sources中,我可以看到do.net.wasm已以某种方式加载。

源代码中的 dotnet.wasm

And by reading some articles like this one I see screenshots that show DLL and wasm being loaded.通过阅读一些像这篇文章这样的文章,我看到了显示 DLL 和正在加载的 wasm 的屏幕截图。

Blazor wasm 上的 Devb 工具网络

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

WASM 网络跟踪

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:如果他们这样做,他们会重新加载:

应用更改导致 BlazorApp1.dll 重新加载

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.

相关问题 如何减小 dotnet.wasm 大小 - How can i decrease dotnet.wasm size SignalR、Blazor WebAssembly 应用程序出现问题 - Problem with SignalR, Blazor WebAssembly app 通过反射加载的DLL是否被缓存? - Are DLLs loaded by reflection being cached? 为什么我看不到服务器端控件的生成ID? - why I don't see generated IDs for server side controls? 具有 docker 支持的 Blazor WebAssembly 应用程序 (linux) - Blazor WebAssembly App with docker support (linux) 无法从 Z98AD8B3C99B34CA16F1F7Assembly WebZEE6 本地访问 Azure Function Api - Can't access Azure Function Api locally from Blazor WebAssembly app 为什么在两种情况下发送两个相同的对象后,Razor/Blazor(WASM) 页面在更新后不刷新? (原因:MudBlazor 表模块)) - Why isn't Razor/Blazor(WASM) page refreshing after update in both cases sending in two identical objects? (Cause: MudBlazor table module)) Blazor webassembly,在应用程序的 OnInitializedAsync 中设置服务,无法进入 Counter.razor - Blazor webassembly, Setting service in App's OnInitializedAsync, can't get in Counter.razor 使用Blazor(即WebAssembly)+ JavaScript - Using Blazor (i.e. WebAssembly) + javascript 使用 Blazor WebAssembly 在 .NET Visual Studio 中找不到 JS 文件 - JS file not being found in .NET visual studio using Blazor WebAssembly
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM