Blazor Wasm为无扩展文件配置mime类型
我使用的是独立的Blazor Wasm应用程序,在Blazor Wasm为无扩展文件配置mime类型,blazor,blazor-webassembly,kestrel-http-server,Blazor,Blazor Webassembly,Kestrel Http Server,我使用的是独立的Blazor Wasm应用程序,在wwwroot文件夹中我有子文件夹\u js,其中包含多个不带扩展名的文件(由工具生成)。Kestrel withdotnet watch不会在响应头中为这些文件设置任何MIME类型,从而导致浏览器抛出 - Failed to load module script: - The server responded with a non-JavaScript MIME type of "". - Strict MIME typ
wwwroot
文件夹中我有子文件夹\u js
,其中包含多个不带扩展名的文件(由工具生成)。Kestrel withdotnet watch
不会在响应头中为这些文件设置任何MIME类型,从而导致浏览器抛出
- Failed to load module script:
- The server responded with a non-JavaScript MIME type of "".
- Strict MIME type checking is enforced for module scripts per HTML spec.
有没有办法将Kestrel配置为将路径wwwroot/_js/*
视为application/javascript
我在Program.cs中只有代码
公共静态异步任务主(字符串[]args)
{
var builder=WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add(“#app”);
addScope(sp=>newHttpClient{BaseAddress=newURI(builder.HostenEnvironment.BaseAddress)});
等待builder.Build().RunAsync();
}
谢谢