Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Hosting the NuGet Gallery Locally in IIS

Rob Reynolds edited this page · 27 revisions
  1. Ensure IIS is installed with the recommended configuration: http://www.microsoft.com/web/gallery/install.aspx?appid=iis7
  2. Ensure IIS URL Rewrite Engine is Installed (alternatively please remove that section from the web.config since it is only used for nuget.org).
  3. Ensure that the .NET Framework 4.5 is installed: http://www.microsoft.com/en-us/download/details.aspx?id=30653
  4. If you don't have Visual Studio 2012 installed, you will need to install the .NET Framework 4.5 Software Development Kit in order to get the reference assemblies: http://msdn.microsoft.com/en-us/windows/desktop/hh852363.aspx (uncheck all other components and install only the .NET Framework 4.5 SDK if you are on Windows 7 or Windows Server 2008/R2)
  5. Get the source: git clone git@github.com:NuGet/NuGetGallery.git
  6. Create a new site in IIS, on port 80 (yes, it must be port 80)
  7. Ensure the new site's app pool is using .NET 4
  8. Ensure that app pool's identity has permission to the database specified in web.config (if using integrated security, otherwise just make sure to set the connection string properly).
  9. Open Visual Studio 2012/2013 and open Package Manager Console
  10. Edit the settings in the Web.config to match your setup, specifically the database connection string and the email settings.
  11. Ensure that the default project is NuGetGallery and go to the Package Manager Console
  12. Run the command Update-Database
  13. If you are not going to use SSL, please edit NuGetGallery/Controllers/AuthenticationController.cs: remove the [RequireSsl] attribute from two methods surrounding Logon.
  14. Edit the dbo.GallerySettings table in Microsoft SQL Server Management Studio so that the SMTP settings, gallery owner name, and gallery owner email are set up appropriately. You may also want users to confirm their email addresses.
  15. Select the Publish command from NuGetGallery and select Custom, enter the details of the server/site you created and publish it OR you can build the site and take the compiled bits and set them up yourself in IIS.
  16. Test the site by going to the home page
  17. Test the API by nuget push <package> -source http://localhost/api/v2/package -apikey <apikey>

If everything works fine, you can register a user and make it an Admin by adding a record to the UserRoles table.

Admin users can view the gallery's error log at http://localhost/elmah.axd

Something went wrong with that request. Please try again.