Anonymous
Mono_wasm: ресурс Webassembly не имеет ожидаемого типа контента «Приложение/wasm», поэтому возвращается к более медленно
Сообщение
Anonymous » 02 сен 2025, 16:11
У меня есть годовое автономное приложение для веб -сайта. Когда я запускаю его от CLI Dotnet Run, я получаю предупреждение, когда я запускаю его от VS2022, я все еще получаю предупреждение, но также получаю ресурсы Dotnet, загруженные в консоли. Я пытался устранить это в течение последних 3 дней без каких -либо успехов. Я попробовал переустановить пакеты, проверив запуск. Предупреждение поступает из файла blazor.webassembly.js. Ядерная опция будет запустить новый проект с нуля и переместить файлы. < /P>
Код: Выделить всё
net9.0
enable
enable
false
true
false
service-worker-assets.js
false
bin\Debug\net9.0\SMART.WiSDoM.BI.Model.dll
< /code>
launchsettings.json
{
"profiles": {
//"http": {
// "commandName": "Project",
// "launchBrowser": true,
// "environmentVariables": {
// "ASPNETCORE_ENVIRONMENT": "Development"
// },
// "dotnetRunMessages": true,
// "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
// "applicationUrl": "http://localhost:5076"
//},
"https": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7129;http://localhost:5076"
}
}
}
< /code>
index.html
const loadingContainer = document.querySelector('.loading-container');
const loadingText = document.querySelector('.loading-text');
const debugMode = false; // IC Used to develop some of the features of the loader 12/08/2025 MAKE SURE TO mark it as false
let totalBytes = 0;
let loadedBytes = 0;
Blazor.start({
loadBootResource: function (type, name, defaultUri, integrity) {
// dotnet.js must return a URI string or it won't allow the code.
if (type === 'dotnetjs') {
return defaultUri;
}
return fetch(defaultUri, { integrity: integrity, cache: 'no-cache' })
.then(response => {
if (!response.ok) throw new Error(response.statusText);
const contentLength = response.headers.get('Content-Length');
if (contentLength) {
totalBytes += parseInt(contentLength, 10);
}
const reader = response.body.getReader();
return new Response(new ReadableStream({
async start(controller) {
while (true) {
if (!debugMode) {
const { done, value } = await reader.read();
if (done) break;
loadedBytes += value.byteLength;
const percent = Math.min(100, Math.floor((loadedBytes / totalBytes) * 100));
loadingText.textContent = `Progress... ${percent}%`;
controller.enqueue(value);
}
}
controller.close();
}
}));
});
}
}).then(() => {
// Blazor is fully ready — fade out loader
loadingText.textContent = "Finished... 100%";
loadingContainer.style.transition = "opacity 0.8s ease";
loadingContainer.style.opacity = "0";
// Remove from DOM after fade
setTimeout(() => {
loadingContainer.remove();
}, 800);
});
An unhandled error has occurred.
[url=.]Reload[/url]
🗙
navigator.serviceWorker.register('service-worker.js');
Подробнее здесь:
https://stackoverflow.com/questions/797 ... pe-applica
1756818682
Anonymous
У меня есть годовое автономное приложение для веб -сайта. Когда я запускаю его от CLI Dotnet Run, я получаю предупреждение, когда я запускаю его от VS2022, я все еще получаю предупреждение, но также получаю ресурсы Dotnet, загруженные в консоли. Я пытался устранить это в течение последних 3 дней без каких -либо успехов. Я попробовал переустановить пакеты, проверив запуск. Предупреждение поступает из файла blazor.webassembly.js. Ядерная опция будет запустить новый проект с нуля и переместить файлы. < /P> [code] net9.0 enable enable false true false service-worker-assets.js false bin\Debug\net9.0\SMART.WiSDoM.BI.Model.dll < /code> launchsettings.json { "profiles": { //"http": { // "commandName": "Project", // "launchBrowser": true, // "environmentVariables": { // "ASPNETCORE_ENVIRONMENT": "Development" // }, // "dotnetRunMessages": true, // "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", // "applicationUrl": "http://localhost:5076" //}, "https": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, "dotnetRunMessages": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "applicationUrl": "https://localhost:7129;http://localhost:5076" } } } < /code> index.html const loadingContainer = document.querySelector('.loading-container'); const loadingText = document.querySelector('.loading-text'); const debugMode = false; // IC Used to develop some of the features of the loader 12/08/2025 MAKE SURE TO mark it as false let totalBytes = 0; let loadedBytes = 0; Blazor.start({ loadBootResource: function (type, name, defaultUri, integrity) { // dotnet.js must return a URI string or it won't allow the code. if (type === 'dotnetjs') { return defaultUri; } return fetch(defaultUri, { integrity: integrity, cache: 'no-cache' }) .then(response => { if (!response.ok) throw new Error(response.statusText); const contentLength = response.headers.get('Content-Length'); if (contentLength) { totalBytes += parseInt(contentLength, 10); } const reader = response.body.getReader(); return new Response(new ReadableStream({ async start(controller) { while (true) { if (!debugMode) { const { done, value } = await reader.read(); if (done) break; loadedBytes += value.byteLength; const percent = Math.min(100, Math.floor((loadedBytes / totalBytes) * 100)); loadingText.textContent = `Progress... ${percent}%`; controller.enqueue(value); } } controller.close(); } })); }); } }).then(() => { // Blazor is fully ready — fade out loader loadingText.textContent = "Finished... 100%"; loadingContainer.style.transition = "opacity 0.8s ease"; loadingContainer.style.opacity = "0"; // Remove from DOM after fade setTimeout(() => { loadingContainer.remove(); }, 800); }); An unhandled error has occurred. [url=.]Reload[/url] 🗙 navigator.serviceWorker.register('service-worker.js'); [/code] Подробнее здесь: [url]https://stackoverflow.com/questions/79752363/mono-wasm-webassembly-resource-does-not-have-the-expected-content-type-applica[/url]