0
votes

This is what I did:

  1. I created a default ASP.NET Web API with the only Values controller. No modification.

  2. I installed all the plugins, libs which you can imagine

  3. I got 503 Service Unavailable

  4. I updated Windows 12R2 with the latest updates and after that I got 500.19 "The requested page cannot be accessed because the related configuration data for the page is invalid." Instead of 503

  5. I modified Configure method in the startup.cs:

     public void Configure(IApplicationBuilder app, IHostingEnvironment 
     env)
     {
         if (env.IsDevelopment())
         {
             app.UseDeveloperExceptionPage();
         }
         else
         {
             app.Use(async (context, next) =>
             {
                 await next();
                 if (context.Response.StatusCode == 404 && 
              !Path.HasExtension(context.Request.Path.Value))
                 {
                     context.Request.Path = "/index.html";
                     await next();
                 }
             });
             app.UseHsts();
         }
    
         app.UseHttpsRedirection();
    
         app.UseCors("CorsPolicy");
    
         app.UseForwardedHeaders(new ForwardedHeadersOptions
         {
             ForwardedHeaders = ForwardedHeaders.All
         });
    
         app.UseStaticFiles();
    
         app.UseMvc();
     }
    

It did not help

  1. I changed the properties of the project, changing IISExpress profile to IIS, played with the different settings for x64, x86 in the deployment settings - nothing helped.

  2. I added [AspNetCoreHostingModel]InProcess[/AspNetCoreHostingModel] into the project file and updated deployed web.config where I replaced:

    [aspNetCore processPath=".\TempTest5.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"/]

with:

  [aspNetCore processPath="dotnet" arguments=".\TempTest5.dll"  
                  stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"
                  hostingModel="InProcess" /]

And nothing helped!

Any ideas are welcome

1
I also installed .NET Core runtime, .NET CORE SDK (Yes, yes), .NET Core Hosting Bundle, and yes, I updated the IIS Pool, setting it to No managed. I also followed the bunch of youtube and guru's tutorials and it does not work.Joe Doe

1 Answers

0
votes

Did you run/install

Install the .NET Core Hosting Bundle

//StartQuote// Install the .NET Core Hosting Bundle on the IIS server. The bundle installs the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module. The module allows ASP.NET Core apps to run behind IIS. //EndQuote//

(from)

https://docs.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-3.1&tabs=visual-studio

Check your app pool. Here is what I have. (Below image)

enter image description here

Here is my web.config (for my (like yours) simple (almost default) app).

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <security>
        <authentication>
          <anonymousAuthentication enabled="true" />
          <windowsAuthentication enabled="true" />
        </authentication>
      </security>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\My.WebApplication.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
    </system.webServer>
  </location>
</configuration>

windowsAuthentication is probably "optional"..aka, you can probably have it as false.