Publish or Host webapi on IIS


Publish webapi on IIS

1.Prerequisites: IIS Configure, .NET Core Hosting Bundle
2. Skip this step if you have already installed 
   - install IIS on your Windows machine if it's not already installed.
   - Go to Control Panel > Programs > Turn Windows features on or off.
   - Check the box for Internet Information Services and click OK.
   - Ensure that the "Web Management Tools" and "World Wide Web Services" options are selected.
   - Under "World Wide Web Services", ensure that "Application Development Features" such as .NET Extensibility, ASP.NET, 
     and ISAPI Extensions are selected.
   - Also, ensure that "Common HTTP Features" like Static Content, Default Document, and Directory Browsing are selected.
   - Additionally, under "Security", ensure that "Request Filtering" is selected.
   - Click OK and wait for the installation to complete.
3. Skip this step if you have already installed .NET Core Hosting Bundle
   - Install the .NET Core Hosting Bundle:
   - Download the .NET Core Hosting Bundle from the official Microsoft website.
   - Run the installer and follow the prompts to complete the installation.
   - This bundle includes the .NET Core Runtime, libraries, and the ASP.NET Core Module for IIS.
4. Publish your .NET Core Web API project:
    - In Visual Studio, right-click on your project in the Solution Explorer and select "Publish".
    - Choose a target (e.g., Folder) and specify a location to publish the files.
    - Click "Publish" to generate the published files.
    - Note the path where the files are published.
5. Configure IIS to host your Web API:
    - Open IIS Manager (you can search for "IIS" in the Start menu).
    - In the Connections pane, right-click on "Sites" and select "Add Website".
    - Fill in the following details:
      - Site name: Enter a name for your site (e.g., MyWebAPI).
      - Physical path: Browse to the folder where you published your Web API files.
      - Binding: Set the type to "http", IP address to "All Unassigned", and specify a port (e.g., 8080).
    - Click "OK" to create the website.
6. Rightclik on website and select Manage Website -> Browse 
   - If everything is configured correctly, your Web API should be accessible via the specified port.
   - For example, if you set the port to 8080, you can access it at http://localhost:8080/api/your-endpoint.


Comments

Popular posts from this blog

Configure Swagger in dotnet core web api