Skip to content

Hosting the NuGet Gallery Locally in IIS

ferventcoder edited this page May 2, 2012 · 38 revisions
  1. Ensure IIS is insalled with the recommended configuation: 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. Get the source: git clone [email protected]:NuGet/NuGetGallery.git
  4. If you are not going to use SSL, please edit NuGetGallery/Website/Controllers/Authentication.cs: remove the [RequireRemoteHttps] attribute from two methods surrounding Logon.
  5. 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
		};
  1. Build the solution (in PowerShell): Build-Solution.ps1
  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. 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).
  5. Test the site by going to the home page
  6. Once the site creates and seeds the database structure, you will likely want to update the SMTP information:
  UPDATE [dbo].[GallerySettings]
  SET 
      [SmtpPort] = ''
      ,[SmtpUsername] = ''
      ,[SmtpHost] = ''
      ,[SmtpPassword] = ''
      ,[UseSmtp] = 1
      ,[GalleryOwnerEmail] = '[email protected]'
  1. Test the API by nuget push <package> -source http://localhost -apikey <apikey>
Clone this wiki locally