Publish .Net 6.0 Web api on IIS

Lorenzo Soncini 1 Reputation point
2022-01-13T12:42:45.033+00:00

For a new project I would like to use the new .Net 6.0 framework for the web api.
I have build the first piece and it run well on the IIS Express and running from command line on my developer machine.

When I try to publish it on IIS I receive the error "404 not found" when try to call any app url.

I recieve this error also if I use IIS on my Windows 10 developing machine.
The step:
I have installed the "Hosting Bundle for 6.0.1"

I have created the AppPool without managed code (also tried with managed code)

I have published on a folder the .Net 6.0 Web Api App, moved the publish folder on the server

How I can chek if the server enviromet is correctly configured for hosting .Net 6.0 apps? There is an utility to do that check?

Thanks for any help
Lorenzo

Internet Information Services
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,128 questions
ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
303 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. AgaveJoe 26,151 Reputation points
    2022-01-13T16:06:12.66+00:00

    What is the URL? Are you sure you are accessing the correct site and not the default site?

    Maybe you created the site under the default site?

    http://localhost/appname/api/values
    

    Or maybe the site you created is under a different port?

    0 comments No comments

  2. Lorenzo Soncini 1 Reputation point
    2022-01-13T16:23:22.117+00:00

    Hi and thanks,
    the api apps is published in the root of a specific (not default) web site.

    The url is https://api-test.domain.it

    If I put a index.html on the root folder and DELETE the .NET 6.0 web api file all work fine
    If I do not delete the .Net 6.0 web api file also the index.html file is not found (Error 404)

    I do not have any info in the event viewer of the machine
    Lorenzo

    0 comments No comments

  3. AgaveJoe 26,151 Reputation points
    2022-01-13T21:00:26.667+00:00

    A 404 is expected unless you have a default route for https://api-test.domain.it or configured swagger as the default.

    If I do not delete the .Net 6.0 web api file also the index.html file is not found (Error 404)

    ASP.NET Core applications use a static file handler for returning static files. The files are located in the wwwroot folder. Add a wwwroot folder to the root of the Web API project and add the static file listener to the application configuration if you want to return static files as a test.

    Static files in ASP.NET Core

    0 comments No comments