Skip to content
This repository
  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. If you are not going to use SSL, please edit NuGetGallery/Website/Controllers/AuthenticationController.cs: remove the [RequireRemoteHttps] attribute from two methods surrounding Logon.
  7. If your SMTP server does not use SSL, you need to edit EnableSsl and set it to false in NuGetGallery/Website/App_Start/ContainerBinding.cs around line 102:
     var mailSenderConfiguration = new MailSenderConfiguration()
        {
            DeliveryMethod = SmtpDeliveryMethod.Network,
            Host = settings.SmtpHost,
            Port = settings.SmtpPort,
            EnableSsl = true
        };
  • Alternatively you can make it configurable by doing the following:
    • NuGetGallery/Website/App_Start/IConfiguration.cs add:
          bool SmtpEnableSsl { get; }
 * NuGetGallery/Website/App_Start/Configuration.cs add:  
        public bool SmtpEnableSsl
        {
            get
            {
                return ReadAppSettings<bool>(
                 "SmtpEnableSsl",
                 (value) => bool.Parse(value ?? bool.TrueString));
            }
        }
 * NuGetGallery/Website/App_Start/ContainerBindings.cs  around line 102 change `EnableSsl = true` to:  
             EnableSsl = configuration.SmtpEnableSsl
 * In the Web.config file, add this to appSettings:  
   <add key="Gallery.SmtpEnableSsl" value="false" />
  1. Build the solution: build.bat from the command line (it builds to _PackagedWebsite)
  2. Create a new site in IIS, mapped to <nuget-source>\Website, on port 80 (yes, it must be port 80)
  3. Ensure the new site's app pool is using .NET 4
  4. Edit the settings in the Web.config to match your setup, specifically the database connection string and the email settings.
  5. 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).
  6. Test the site by going to the home page
  7. 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.