Search code examples
azure-web-app-serviceblazorvisual-studio-2019.net-5blazor-webassembly

Why does removing FetchData.razor from a default Blazor WASM project cause it to fail in Azure App Services?


I am trying to publish a hosted Blazor WASM to an Azure App Service. I am working with VS 2019 and .NET 5.0 (VS 2019 says it cannot support .NET 6.0). I create a default hosted Blazor WASM through the VS UI, and when I publish the Server project to a new Azure App Service (all default settings), everything runs ok.

However, when I remove the FetchData.razor component and republish, I get the following error in my console:

Uncaught (in promise) Can't find bindings module assembly: System.Private.Runtime.InteropServices.JavaScript blazor.webassembly.js:1

I am completely confused as to why this error happens when a razor page is removed from the project. I searched the project and it isn't referenced anywhere else. When I add the page back and republish suddenly it is working again. Running the app locally with 'dotnet watch run' works perfectly fine.

If anyone is also able to replicate this or has any ideas on how to fix it I would greatly appreciate it.


Solution

  • Just throwing an idea, you deleted fetchdata.razor file but still there might be a reference of this in file NavMenu.razor, like this

     <div class="nav-item px-3">
                <NavLink class="nav-link" href="fetchdata">
                    <span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
                </NavLink>
     </div>
    

    So try removing above code form you project and see if it's all good!