Can I serve a wasm file in ASP.NET?

377 Views Asked by At

I am using a third party javascript file in a project that makes a call to a wasm file. Can I call this and server it the same way I do a javascript file in script tags?

1

There are 1 best solutions below

0
On BEST ANSWER

Yes, For Asp.Net Core we did the following to Serve the file:

    // https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-2.2#fileextensioncontenttypeprovider
    var provider = new FileExtensionContentTypeProvider {Mappings = {[".wasm"] = "application/wasm"}};

    app.UseStaticFiles(new StaticFileOptions
    {
        ContentTypeProvider = provider,
        ...
    }