admin管理员组

文章数量:1390564

I am receiving the following message in my log file:

'The WebRootPath was not found: C:\inetpub\CondoWebSite\condo11. Static files may be unavailable.' when I try to start my website.

Using IIS10 on windows server 2022. DotNet core 9.0.3

app.UseDefaultFiles();
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions()
{
 FileProvider = new PhysicalFileProvider(
    Path.Combine(builder.Environment.ContentRootPath, "condo11")),
 RequestPath = "/assets"
});

Note that the startup.cs executes properly (ie connects to SQ and executes initializing code) Full access was given to IUSR, IIS_IUSRS , System, Administrators

Lastly when I try to browse the index.html I get an Http error 404

I am receiving the following message in my log file:

'The WebRootPath was not found: C:\inetpub\CondoWebSite\condo11. Static files may be unavailable.' when I try to start my website.

Using IIS10 on windows server 2022. DotNet core 9.0.3

app.UseDefaultFiles();
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions()
{
 FileProvider = new PhysicalFileProvider(
    Path.Combine(builder.Environment.ContentRootPath, "condo11")),
 RequestPath = "/assets"
});

Note that the startup.cs executes properly (ie connects to SQ and executes initializing code) Full access was given to IUSR, IIS_IUSRS , System, Administrators

Lastly when I try to browse the index.html I get an Http error 404

Share Improve this question edited Mar 13 at 6:39 Jason 22.5k2 gold badges22 silver badges45 bronze badges asked Mar 12 at 13:20 Guy GallantGuy Gallant 3531 gold badge4 silver badges13 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

From the error message, it seems that the condo11 folder you created in the project root directory was not included when publishing. You can achieve this with the following code.

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <RootNamespace>_79503733</RootNamespace>
  </PropertyGroup>
  <!--Add below settings-->
  <ItemGroup>
    <None Include="condo11\**">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>
</Project>

本文标签: aspnet coreError message from IIS 100 The WebRootPath was not foundStack Overflow