BaGet

Windows IIS Proxy

With a few extra steps you can run BaGet Extension behind a Windows IIS proxy. This has many benefits, including automatic restarts on reboots.

IIS setup

  1. Install the .NET 10 Hosting Bundle on the web server, then restart IIS. Use a published build: dotnet publish generates the web.config.
  2. Copy the BaGet Extension directory over to your hosting area such as C:\Inetpub\wwwroot\BaGet
  3. Using IIS Manager, create a new Application Pool:

    • Name = BaGetAppPool (can be whatever you want)
    • .NET CLR version = No Managed Code
    • Managed Pipeline Mode = Integrated
    • Start application pool immediately = checked
  4. Using IIS Manager, create a new web site:
    • Choose your site name and physical path
    • Choose BaGetAppPool as the application pool
    • In the Binding area, enter the host name and port you want to serve. Under IIS in-process hosting the Kestrel endpoint (localhost:6060) in appsettings.json is not used.

BaGet Extension folder permissions

You may need to give special permissions to the top-level BaGet Extension folder so that the app can persist its state. This is necessary as the Application Pools’ identity is a virtual account that isn’t recognized by the Windows User Management Console. For more information, please refer to ASP.NET Core’s documentation:

Alternative storage path

!!! info Virtual Directories do not work with IIS and Kestrel. For more information, please refer to ASP.NET Core’s documentation.

Ensure that the configuration’s storage Path has the appropriate forward slashes:

...
  "Storage": {
    "Type": "FileSystem",
    "Path": "C://AnotherFolder/Packages"
  },
...

Note that you will need to adjust folder permissions if the Path is created outside of the BaGet Extension top-level directory. See the BaGet Extension Folder Permissions.

API key

With an empty ApiKey and accounts on (the default), a push needs a user API key from /account/apikeys; or set ApiKey and pass it with -k. See Require an API key.

Logging under IIS

IIS server options

Settings such as the maximum package size can be configured for IIS in the appsettings.json file - see IIS Server Options.