How to Self-Host QNE API in IIS

Modified on Wed, Apr 2 at 11:08 AM


Overview:

Deploying QNE API into Internet Information Services (IIS) allows users to run the API locally within
their network without relying on external hosting. This guide provides a step-by-step process to
ensure a successful deployment of QNE API on IIS.


Scenario:

You need to host the QNE API on a Windows server using IIS to enable local API access. This
deployment ensures seamless integration with other applications within your network while
maintaining control over security and performance.


Procedure:


Step 1: Install .NET Core Windows Server Hosting Bundle

  • Download the .NET Core Windows Server Hosting bundle from the following link:
    Download Here


  • Run the installer and follow the on-screen instructions to complete the installation.


Step 2: Install IIS

  • Open Control Panel > Programs > Programs and Features.


  • Click Turn Windows features on or off


  • Enable all required IIS components as shown below.


A screenshot of a computer 
AI-generated content may be incorrect.



A screenshot of a computer 
AI-generated content may be incorrect.


  • Click OK and wait for the installation to complete.



Step 3: Download and Extract QNE API

  • Download the QNE API package from the following link:
    Download Here


  • Extract the API files to a preferred location on your server.



Step 4: Configure IIS

  • Press the Windows key, type IIS in the search bar, and select Internet Information Services
    (IIS) Manager.


  • In IIS Manager, expand the server node on the left panel.


  • Right-click on Sites and select Add Website.


  • Fill in the following details:

  1. Site Name: Enter a preferred name for your site.

  2. Physical Path: Click Browse, then select the folder containing the QNE API files.

  3. Port: Assign an unused port (e.g., 5001).

  4. Host Name: Leave blank or enter the server's IP address if accessing from another machine
    on the network.

  5. Click OK to create the site.


A screenshot of a computer 
AI-generated content may be incorrect.


    Note: Ensure that the assigned port is allowed through the firewall to enable external access. You
    can configure this in Windows Defender Firewall under Advanced settings > Inbound Rules by
    creating a new rule to allow traffic on the port.



Step 5: Modify Advanced Settings

  • In IIS Manager, navigate to Application Pools.


  • Locate the newly created website, right-click, and select Advanced Settings.


  • Set Load User Profile to False.

A screenshot of a computer 
AI-generated content may be incorrect.


  • Click OK to apply changes.



Step 6: Modify Advanced Settings

  • Navigate to the API folder and locate the appsettings.json file.


  • Open the file using Notepad.


  • Modify the connection string settings by assigning the appropriate database code (DbCode), 
    such as DemoDb.


    Security Note: The DbCode is a static authentication key associated with a specific database

    record. For security reasons, ensure that your DbCode is strong and not easily guessable.

           A screenshot of a computer 
AI-generated content may be incorrect. 

    • Data Source = Your QNE/SQL Server’s IP and Port Number

    • Initial Catalog = The name of the database to connect to

    • User Id = The username of the SQL Server system administrator account

    • Password = The password for the specified use


  • Save the changes and close the file.



Step 6: Test the Deployment

  • In IIS Manager, select the newly created website.

  • Click Browse on the right-side panel or manually enter http://<server-ip>:5001 in a web
    browser.

  • If the Swagger UI loads successfully, the deployment is complete.



Step 7: Authorizing API Requests in Swagger UI

  • In the Swagger UI, click the Authorize button at the top right.


  • Locate the DbCode (apiKey) field, enter your DbCode, and click Authorize.

A screenshot of a computer 
AI-generated content may be incorrect.


  • Click Close.

  • Once authorized, you can test API endpoints to verify they return the expected responses.



Application:


Once deployed, QNE API can be used for various integrations, including:


  • Connecting third-party applications for data retrieval and processing.

  • Enabling automated transactions and reporting within the local network.

  • Securing API access within a controlled server environment.



By following this guide, users can efficiently self-host QNE API in IIS, ensuring a stable and
accessible API environment within their organization.







Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article