-
Notifications
You must be signed in to change notification settings - Fork 644
Hosting the NuGet Gallery Locally in IIS
Loïc Sharma edited this page Jun 17, 2019
·
38 revisions
- Ensure IIS is installed with the recommended configuration: http://www.microsoft.com/web/gallery/install.aspx?appid=iis7.
- Ensure IIS URL Rewrite Engine is Installed (alternatively please remove that section from the web.config since it is only used for nuget.org).
- Ensure that the .NET Framework 4.5 is installed: http://www.microsoft.com/en-us/download/details.aspx?id=30653.
- 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).
- Get the source:
git clone [email protected]:NuGet/NuGetGallery.git
- Create a new site in IIS, on port 80 (YES, it must be port 80)
- Ensure the new site's app pool is using .NET 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). Open Visual Studio 2012/2013 and open Package Manager Console Edit the settings in the Web.config to match your setup, specifically the database connection string and the email settings.
- Ensure that the default project is NuGetGallery and go to the Package Manager Console
Run the command
Update-Database -ConfigurationTypeName MigrationsConfiguration
.- If you are not going to use SSL, please edit
NuGetGallery/Controllers/AuthenticationController.cs
: remove the [RequireSsl] attribute from two methods surrounding Logon. - 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.
- If you are not going to use SSL, please edit
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. Test the site by going to the home page Test the API by nuget push -source http://localhost/api/v2/package -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