locked
Sample web.config for an asp.net core hosted blazor webassembly app RRS feed

  • Question

  • User-1312580838 posted

    Hi blazor experts,

    first of all:  A great job so far, it is a joy to make a project with blazor webassembly, thanks to the team!

    There is a problem left by deploying an app on iis. My project is a blazor webassembly asp.net core hosted one.

    I choose publish of the server project to a folder and i've copied the files to my iis dir.
    My service controllers route is always [Route("/api/[controller]")].
    So my service is working and is responding to http://localhost/abc/api/...

    But my web app does not work on http://localhost/abc.

    I think, the right combination of

    index.html: <base href="/..." />
    web.config: aspNetCore handlers
    web.config: URL rewrite configuration

    is needed here. 

    Does anyone have a sample web.config for an asp.net core hosted blazor webassembly app?

    Thanks a lot and have a nice day,
    Ulrich

    visual studio 16.7.7
    .NET core 3.1

    Thursday, November 5, 2020 9:36 AM

All replies

  • User420619686 posted

    Did you ever get an answer for this?  When I publish from Visual Studio I get a 500.19 error:

    The requested page cannot be accessed because the related configuration data for the page is invalid.


    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <location path="." inheritInChildApplications="false">
        <system.webServer>
          <handlers>
            <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
          </handlers>
          <aspNetCore processPath="dotnet" arguments=".\EReg.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
        </system.webServer>
      </location>
    </configuration>
    <!--ProjectGuid: -->

    Friday, January 29, 2021 1:13 AM
  • User-1312580838 posted

    Never got an answer for this.

    To get it running in IIS in an application "abc", the following steps are important:

    Set the app name in index.html: <base href="/abc/" />

    All navigation paths and controller routes in the app must be relative: x/y/z

    Hope this helps,

    Ulrich

    Friday, January 29, 2021 12:31 PM