How To Setup the Chocolatey.Server Package
- What is Chocolatey.Server?
- Setup with Puppet
- Setup Normally
- Additional Configuration
- Common Errors and Resolutions
- Error 500
- Error 500.19 - "The requested page cannot be accessed because the related configuration data for the page is invalid."
- Other error
What is Chocolatey.Server?
The Chocolatey.Server package contains the binaries for a fully ready to go Chocolatey NuGet Server where you can serve packages over HTTP using a NuGet-compatible OData feed.
Chocolatey Server is a simple Nuget.Server that is ready to rock and roll. It has already completed Steps 1–3 of NuGet's host your own remote feed. Version 0.1.2 has the following additional adds:
- Uses same enhanced NuGet that Chocolatey uses so you can see more information in search if you choose to use those things.
- Allows packages up to 2GB. Package size can be controlled through maxAllowedContentLength and maxRequestLength.
When you install it, it will install the website typically to
Setup with Puppet
If you are using the Puppet module chocolatey/chocolatey_server, it will do all of the additional setup for this package and allow some customization.
The module works with Windows Server 2008/2012.
For a simple
include chocolatey_server it does the following automatically:
- Ensures IIS is installed
- Ensures ASP.NET is installed
- Ensures the chocolatey.server package is installed
- Ensures an app pool for the chocolatey.server site
- Ensures the IIS website is setup for chocolatey.server
- Ensures permissions for the site are set correctly.
- Install or upgrade the package -
choco upgrade chocolatey.server -y
- Ensure IIS is installed. You can try
choco install IIS-WebServer --source windowsfeatures
- Ensure that ASP.NET is installed. Try
choco install IIS-ASPNET45 --source windowsfeatures(Windows Server 2012). Use
IIS-ASPNETfor Windows Server 2008, possibly
IIS-ASPNET46for Windows Server 2016.
- Disable or remove the Default website
- Set up an app pool for Chocolatey.Server. Ensure 32-bit is enabled and the managed runtime version is
v4.0(or some version of 4).
- Set up an IIS website pointed to the install location and set it to use the app pool.
- Go to explorer and right click on
c:\tools\chocolatey.serverand add the following permissions:
IIS APPPOOL\<app pool name>- Read
- Right click on the
App_Datasubfolder and add the following permissions:
IIS APPPOOL\<app pool name>- Modify
Looking for where the apikey is and how it is changed, that is all done through the web.config. The config is pretty well-documented on each of the appSettings key values.
To update the apiKey, it is kept in the web.config, search for that value and update it. If you reach out to the server on https://localhost (it will show you what the apikey is, only locally though).
To configure for performance, you will want to do the following:
- Keep the site warm (https://serverfault.com/a/595215/79259):
- Turn on Application Initialization in Windows Features under Web Server (IIS) -> Web Server -> Application Development -> Application Initialization (you can also try
choco install IIS-ApplicationInit --source windowsfeatures)
- Application Pool Advanced Settings:
- General: Start Mode -> Always Running
- Process Model: Idle Time-out (minutes) -> 0
- Recycling: Regular Time Interval (minutes) -> 0
- Under the Site's Advanced Settings:
- Preload Enabled -> True
We are looking to add support for the package source to automatically handle this aspect - http://blog.nuget.org/20150922/Accelerate-Package-Source.html
Common Errors and Resolutions
When you are attempting to install the Simple Server, you may run into some errors depending on your configuration. Here are some common ones we've seen that you may get when you browse to the the site.
Take a closer look at the error. It may be one of the other errors below.
Error 500.19 - "The requested page cannot be accessed because the related configuration data for the page is invalid."
This can mean a couple of things:
- You missed ensuring the website is using an app pool that is at least .NET 4.0. Check the app pool that your site is using, then ensure that app pool has
32-bitenabled and the managed runtime version is
v4.0(or some version of 4).
- You have made a change to the xml file and it is not valid xml. This typically happens if you put an xml escape character into the password (
&). To do that you would need to set CData around the value or use a different password. It could also happen if you accidentallly change the xml and it is no longer valid.
Turn on customErrors under system.web -
Then browse to the site to see if you can gather any more information.
If so, and you are a commercial edition customer, please open a support ticket. If you are using open source Chocolatey, please open a ticket at https://github.com/chocolatey/simple-server/issues.