locked
My first Blazor App, run under localhost - no default file RRS feed

  • Question

  • User-1482891610 posted

    Hi
    I am learning Blazor having been a web forms developer for many years.I have VS 2019, I have craeted my first Blazor app (BlazorApp1) using tfe built in template which is the demo of how it works (has navigation of (Home, Counter, Fetche Data).  The app works fine if I run it in debug within VS 2019 (IIS Express).  However when I try and load the app via http://localhost/BlazorApp1  i get the below error:

    A default document is not configured for the requested URL, and directory browsing is not enabled on the server.

    Things you can try:

    • If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists.
    • Enable directory browsing using IIS Manager.
      1. Open IIS Manager.
      2. In the Features view, double-click Directory Browsing.
      3. On the Directory Browsing page, in the Actions pane, click Enable.
    • Verify that the configuration/system.webServer/directoryBrowse@enabled attribute is set to true in the site or application configuration file.

    I have created BlazorApp1 as a Virtual in IIS, is there something im missing. 

    Many thanks in advance

    Thursday, November 14, 2019 8:30 PM

All replies

  • User61956409 posted

    Hi,

    I have created BlazorApp1 as a Virtual in IIS, is there something im missing. 

    Firstly, In this document, you can find that IIS Virtual Directories aren't supported with ASP.NET Core apps. You can try to host your Blazor app as a sub-application.

    Besides, if you are using in-process hosting, please make it run in separate app pool. For more information, please check this document.

    • In-process hosting – Apps are required to run in separate app pools.
    • Out-of-process hosting – We recommend isolating the apps from each other by running each app in its own app pool.

    With Regards,

    Fei Han

    Friday, November 15, 2019 6:43 AM
  • User-1482891610 posted

    Hi

    Thanks for the above posts.  I have tried the above but not had any joy.  I have a feeling it maybe due to .Net Core.  I can create a MVC app anbd run it under local host witout any issues.  However when I try and create a .Net Core app it seems to fail.

    So just to confirm that can I run a MVC or Blazor app under localhost, or does it have to have its own IIS Website (eg myblazor.com which I create in IIS and then tweak the local DNS host file to reflect this).

    Im doing thsi on my Win 10 machine.  I have installed .Net Core (.NET Core 3.0 Runtime & Hosting Bundle for Windows (v3.0.0)).  This has created a AspNetCoreModuleV2 entity in IIS > Modules.  However I do not see a V1 or "AspNetCoreModule", could this be the issue?

    Is there anything else I need when running a .Net Core app, I have VS 2019 (16.3.9).  I am literally going File > New Project > Blazor App.  I am not chaning the code at all - it runs under IIS Express (Debug mode).  But under http://localhost/BlazorApp1

    I have tried:
    1) Create a new app pool, set this as "No Managed Code" and applied this to the App - still get HTTP Error 403.14 - Forbidden
    2) Tried the publish option in VS to push content into another folder under IIS and load (http://localhost/BlazorApp1Pub ) but no joy still get HTTP Error 403.14 - Forbidden
    3) Created a new website in IIS (myblazor.com) changed local host to refelct this but this does not work at all - i get page cannot be raeched.  I have pinged myblazor.com and it resolves to 127.0.0.1 - could it be a DNS issue

    Is there something im missing?

    Many thanks inadvance

    Sunday, November 17, 2019 3:03 PM
  • User61956409 posted

    Hi,

    Please refer to this tutorial and check if you setup hosting environment correctly.

    https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.0#iis-configuration

    And, you can try to create new web site on IIS, then publish your Blazor application to corresponding web site (leaving host name empty) and check if you can browse it.

    If your Blazor application still can not work well on IIS, to determine if IIS is configured well for hosting .NET core applications, you can try to deploy another .NET core application, such as .NET core MVC application, to web site and check if it can run as expected on IIS web site. 

    With Regards,

    Fei Han

    Monday, November 18, 2019 8:43 AM
  • User-1482891610 posted

    Hi,

    Thanks for the below, much appreciated.  So I have managed to get a better error mesaage of:

    HTTP Error 500.31 - ANCM Failed to Find Native Dependencies

    Common solutions to this issue:

    The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.

    So I am assumkng my app is hitting IIS correctly and trying to do something

    My process so far is:

    1) Create a the default Blazor app in VS 2019 (http://localhost/BlazorApp1 ) when I run it in VS (IIS Express) it works
    2) I have craeted a Application in IIS called BlazorApp1 under default website, but I have created a seperate App Pool which has "No Managed Code" set thsi on the application
    3) I have tweaked the web.config to the below and then tried it in IIS (http://localhost/BlazorApp1) and I get the above error message

    <?xml version="1.0"?>

    <configuration>

    <system.web>

    <compilation debug="true" targetFramework="4.0" />

    </system.web>

    <location path="." inheritInChildApplications="false">

    <system.webServer>

    <modules runAllManagedModulesForAllRequests="true" />

    <handlers>

    <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />

    </handlers>

    <aspNetCore processPath="dotnet" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="inprocess">

    <environmentVariables>

    <environmentVariable name="COMPLUS_ForceENC" value="1" />

    <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />

    </environmentVariables>

    </aspNetCore>

    </system.webServer>

    </location>

    </configuration>

    Do I have to Publish the website, or is it okay to leave IIS to look at the Project Folder that was created (which happens to be in wwwroot/BlazorApp1)

    Sorry if my questions are basic, having done web forms for too many years - i didnt realise getting a basic setup working was going to be so difficult

    Many thanks in advance

    Wednesday, November 20, 2019 8:52 AM
  • User61956409 posted

    Hi,

    HTTP Error 500.31 - ANCM Failed to Find Native Dependencies

    Common solutions to this issue:

    The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.

    The cause of this startup failure is when the Microsoft.NETCore.App or Microsoft.AspNetCore.App runtime isn't installed.

    For example, if the app is deployed to target ASP.NET Core 3.0 and that version doesn't exist on the machine, this error would occur.

    So please try to install the appropriate version of .NET Core on the machine, then check if the issue can be fixed.

    With Regards,

    Fei Han

    Friday, November 22, 2019 6:03 AM
  • User932909087 posted

    Hi,

    Thanks for the below, much appreciated.  So I have managed to get a better error mesaage of:

    HTTP Error 500.31 - ANCM Failed to Find Native Dependencies

    Common solutions to this issue:

    The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.

    Hi BigMeat,

    Could you please make sure that you have installed .net core 3 bundle on your server? From the error message, it seems that .net core hasn't been installed. Please install it via https://dotnet.microsoft.com/download/dotnet-core/3.0

    Monday, November 25, 2019 5:02 AM
  • User-1482891610 posted

    Hi
    Thanks for the advice.  I have installed the latest .Net Core and asp .Net - but now I get

    HTTP Error 500.0 - ANCM In-Process Handler Load Failure

    I didnt realise this was going to be so difficult to do -

    Thanks again

    Monday, November 25, 2019 10:44 AM