Blazor server-side app throws error: The SPA default page middleware could not return the default page '/index.html'










2















I found a client-side Blazor app that implements Identity here.



It works correctly, but when I turn it to server-side Blazor it throws an error:




"Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll ("The SPA default page middleware could not return the default page '/index.html' because it was not found, and no other middleware handled the request.")
on CsrfTokenCookieMiddleware line 28.




I really don't know what the problem could be. I guessed the error occurs because when using server-side Blazor, more logic is handed over to the Server project instead of the Client project, and the server doesn't contain a wwwroot. Therefore I created a symlink from the wwwroot of the Server project to the wwwroot of the Client project. But that also didn't work.



Can anybody help me with this issue? I am completely stuck. The creator also doesn't know what the problem is.










share|improve this question




























    2















    I found a client-side Blazor app that implements Identity here.



    It works correctly, but when I turn it to server-side Blazor it throws an error:




    "Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll ("The SPA default page middleware could not return the default page '/index.html' because it was not found, and no other middleware handled the request.")
    on CsrfTokenCookieMiddleware line 28.




    I really don't know what the problem could be. I guessed the error occurs because when using server-side Blazor, more logic is handed over to the Server project instead of the Client project, and the server doesn't contain a wwwroot. Therefore I created a symlink from the wwwroot of the Server project to the wwwroot of the Client project. But that also didn't work.



    Can anybody help me with this issue? I am completely stuck. The creator also doesn't know what the problem is.










    share|improve this question


























      2












      2








      2








      I found a client-side Blazor app that implements Identity here.



      It works correctly, but when I turn it to server-side Blazor it throws an error:




      "Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll ("The SPA default page middleware could not return the default page '/index.html' because it was not found, and no other middleware handled the request.")
      on CsrfTokenCookieMiddleware line 28.




      I really don't know what the problem could be. I guessed the error occurs because when using server-side Blazor, more logic is handed over to the Server project instead of the Client project, and the server doesn't contain a wwwroot. Therefore I created a symlink from the wwwroot of the Server project to the wwwroot of the Client project. But that also didn't work.



      Can anybody help me with this issue? I am completely stuck. The creator also doesn't know what the problem is.










      share|improve this question
















      I found a client-side Blazor app that implements Identity here.



      It works correctly, but when I turn it to server-side Blazor it throws an error:




      "Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll ("The SPA default page middleware could not return the default page '/index.html' because it was not found, and no other middleware handled the request.")
      on CsrfTokenCookieMiddleware line 28.




      I really don't know what the problem could be. I guessed the error occurs because when using server-side Blazor, more logic is handed over to the Server project instead of the Client project, and the server doesn't contain a wwwroot. Therefore I created a symlink from the wwwroot of the Server project to the wwwroot of the Client project. But that also didn't work.



      Can anybody help me with this issue? I am completely stuck. The creator also doesn't know what the problem is.







      asp.net-core server-side asp.net-core-identity blazor






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 21 at 19:02









      ekad

      12.2k123742




      12.2k123742










      asked Nov 15 '18 at 20:55









      Max BergmanMax Bergman

      111




      111






















          1 Answer
          1






          active

          oldest

          votes


















          -2














          When you do server-side rendering with blazor, that don't use the blazor.webassembly.js for bootstrap the app, instead it uses blazor.server.js.



          in your index.html file which resides in wwwroot file says as below,






          <script src="_framework/blazor.webassembly.js"></script>





          I checked the given GitHub repo and found the above script tag.
          Make it to the shown as below and try,






          <script src="_framework/blazor.server.js"></script>





          The server-side rendering of the blazor does not run in the web assembly it runs in the asp.net core host and makes the communication with UI thread with signal R. This is the major difference between server-side rendering and client-side rendering of blazor.






          share|improve this answer

























          • This is what I've done to let the app run server-side Blazor. But then I get my error as described above.

            – Max Bergman
            Nov 16 '18 at 8:15











          • is that blazor.server.js file available at the location of "ServerSideBlazor.AppbinDebugnetstandard2.0dist_framework"?

            – manoj b86
            Nov 16 '18 at 10:10










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327764%2fblazor-server-side-app-throws-error-the-spa-default-page-middleware-could-not-r%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          -2














          When you do server-side rendering with blazor, that don't use the blazor.webassembly.js for bootstrap the app, instead it uses blazor.server.js.



          in your index.html file which resides in wwwroot file says as below,






          <script src="_framework/blazor.webassembly.js"></script>





          I checked the given GitHub repo and found the above script tag.
          Make it to the shown as below and try,






          <script src="_framework/blazor.server.js"></script>





          The server-side rendering of the blazor does not run in the web assembly it runs in the asp.net core host and makes the communication with UI thread with signal R. This is the major difference between server-side rendering and client-side rendering of blazor.






          share|improve this answer

























          • This is what I've done to let the app run server-side Blazor. But then I get my error as described above.

            – Max Bergman
            Nov 16 '18 at 8:15











          • is that blazor.server.js file available at the location of "ServerSideBlazor.AppbinDebugnetstandard2.0dist_framework"?

            – manoj b86
            Nov 16 '18 at 10:10















          -2














          When you do server-side rendering with blazor, that don't use the blazor.webassembly.js for bootstrap the app, instead it uses blazor.server.js.



          in your index.html file which resides in wwwroot file says as below,






          <script src="_framework/blazor.webassembly.js"></script>





          I checked the given GitHub repo and found the above script tag.
          Make it to the shown as below and try,






          <script src="_framework/blazor.server.js"></script>





          The server-side rendering of the blazor does not run in the web assembly it runs in the asp.net core host and makes the communication with UI thread with signal R. This is the major difference between server-side rendering and client-side rendering of blazor.






          share|improve this answer

























          • This is what I've done to let the app run server-side Blazor. But then I get my error as described above.

            – Max Bergman
            Nov 16 '18 at 8:15











          • is that blazor.server.js file available at the location of "ServerSideBlazor.AppbinDebugnetstandard2.0dist_framework"?

            – manoj b86
            Nov 16 '18 at 10:10













          -2












          -2








          -2







          When you do server-side rendering with blazor, that don't use the blazor.webassembly.js for bootstrap the app, instead it uses blazor.server.js.



          in your index.html file which resides in wwwroot file says as below,






          <script src="_framework/blazor.webassembly.js"></script>





          I checked the given GitHub repo and found the above script tag.
          Make it to the shown as below and try,






          <script src="_framework/blazor.server.js"></script>





          The server-side rendering of the blazor does not run in the web assembly it runs in the asp.net core host and makes the communication with UI thread with signal R. This is the major difference between server-side rendering and client-side rendering of blazor.






          share|improve this answer















          When you do server-side rendering with blazor, that don't use the blazor.webassembly.js for bootstrap the app, instead it uses blazor.server.js.



          in your index.html file which resides in wwwroot file says as below,






          <script src="_framework/blazor.webassembly.js"></script>





          I checked the given GitHub repo and found the above script tag.
          Make it to the shown as below and try,






          <script src="_framework/blazor.server.js"></script>





          The server-side rendering of the blazor does not run in the web assembly it runs in the asp.net core host and makes the communication with UI thread with signal R. This is the major difference between server-side rendering and client-side rendering of blazor.






          <script src="_framework/blazor.webassembly.js"></script>





          <script src="_framework/blazor.webassembly.js"></script>





          <script src="_framework/blazor.server.js"></script>





          <script src="_framework/blazor.server.js"></script>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 16 '18 at 6:36

























          answered Nov 15 '18 at 21:52









          manoj b86manoj b86

          6415




          6415












          • This is what I've done to let the app run server-side Blazor. But then I get my error as described above.

            – Max Bergman
            Nov 16 '18 at 8:15











          • is that blazor.server.js file available at the location of "ServerSideBlazor.AppbinDebugnetstandard2.0dist_framework"?

            – manoj b86
            Nov 16 '18 at 10:10

















          • This is what I've done to let the app run server-side Blazor. But then I get my error as described above.

            – Max Bergman
            Nov 16 '18 at 8:15











          • is that blazor.server.js file available at the location of "ServerSideBlazor.AppbinDebugnetstandard2.0dist_framework"?

            – manoj b86
            Nov 16 '18 at 10:10
















          This is what I've done to let the app run server-side Blazor. But then I get my error as described above.

          – Max Bergman
          Nov 16 '18 at 8:15





          This is what I've done to let the app run server-side Blazor. But then I get my error as described above.

          – Max Bergman
          Nov 16 '18 at 8:15













          is that blazor.server.js file available at the location of "ServerSideBlazor.AppbinDebugnetstandard2.0dist_framework"?

          – manoj b86
          Nov 16 '18 at 10:10





          is that blazor.server.js file available at the location of "ServerSideBlazor.AppbinDebugnetstandard2.0dist_framework"?

          – manoj b86
          Nov 16 '18 at 10:10



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327764%2fblazor-server-side-app-throws-error-the-spa-default-page-middleware-could-not-r%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Top Tejano songwriter Luis Silva dead of heart attack at 64

          ReactJS Fetched API data displays live - need Data displayed static

          政党