"ResourceNotFound(404)" error and requests to the DSC pull server fail

Van toepassing: Windows Server 2016

Symptoms


Assume that you configure a Desired State Configuration (DSC) pull server on Windows Server 2016 as a web service that is running in Web Server through Internet Information Services (IIS).

In this scenario, the DSC pull server application responds to incoming requests by generating a "ResourceNotFound(404)" error message. This is especially true when you recycle the application pool, or the application pool is recycled automatically because of the IIS settings. Additionally, an Event 623 may be logged in the Application log:

Log Name:        Application
Source:             ESENT
Event ID:           623
Task Category:  Transaction Manager
Level:                Error
Description:
w3wp (10204) PSDSCPullSever: The version store for this instance (0) has reached its maximum size of 32Mb. It is likely that a long-running transaction is preventing cleanup of the version store and causing it to build up in size. Updates will be rejected until the long-running transaction has been completely committed or rolled back.

Cause


This problem may have any of the following causes.

Cause 1

The Extensible Storage Engine (ESE) database Version Store area is being exhausted. This may be caused by a large transaction when the application pool is recycled.

Cause 2

More than one worker process is configured for the "PSWS" application pool. DSC uses the Devices.edb database file, and this file must be opened in Exclusive mode (only one process at a time can access the database). Therefore, other worker processes cannot access the file, and those database lookups fail.

Cause 3

When it recycles a W3WP.exe process, IIS starts the new process before the previous process stops. The new process cannot access the database while the old process continues to own it.

Resolution


To fix this problem, follow the steps for the appropriate resolution

Resolution 1: The ESE database Version Store area is being exhausted

Configure the size of the Version Store. To do this, follow these steps:

  1. Install the Cumulative Update for Windows Server 2016 for x64-based Systems (KB4480977).
  2. Copy the Microsoft.Powershell.DesiredStateConfiguration.Service.dll file from the following location:
    C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PullServer
  3. Paste the file to the following location (or the configured folder if the root path has been changed):
    C:\inetpub\PSDSCPullServer\bin\
  4. Configure the size of the Version Store by adding the MaxVerPages and PreferredVerPages parameters in the Web.config file of the application.

    Note The Web.config is located in the following location (or your custom folder):
    C:\inetpub\PSDSCPullServer
     

    For example, if MaxVerPages is set to 24576, the Version Store size is set as follows:

    24576 * 16 = 393MB in 32 bit mode

    24576 * 32 = 786 MB in 64 bit mode

    The recommended value for PreferredVerPages is about 80 percent of MaxVerPages value. If custom values are not specified, the following defaults values are used:

    MaxVerPages = 1024

    PreferredVerPages = 1024

    For example, set the following values.

    </managementOdata>
    <appSettings>
      <add key="MaxConcurrentRequests" value="10000" />
      <add key="MaxRequestsPerTimeslot" value="10000" />
      <add key="TimeslotSize" value="1" />
      <!---->
      <add key="dbprovider" value="ESENT" />
      <add key="dbconnectionstr" value="C:\Program Files\WindowsPowerShell\DscService\Devices.edb" />
      <!---->
      <!--
      <add key="dbprovider" value="System.Data.OleDb" />
      <add key="dbconnectionstr" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\WindowsPowerShell\DscService\Devices.mdb;"/>
      -->
      <add key="ConfigurationPath" value="C:\Program Files\WindowsPowerShell\DscService\Configuration" />
      <add key="ModulePath" value="C:\Program Files\WindowsPowerShell\DscService\Modules" />
      <add key="RegistrationKeyPath" value="C:\Program Files\WindowsPowerShell\DscService" />
      <add key="MaxVerPages" value="24576" />
      <add key="PreferredVerPages" value="19600" />

    </appSettings>

  5. Save the changes, and then restart IIS.


Resolution 2: More than one worker process is configured for the "PSWS" application pool

Reset the number of IIS worker processes to 1. To do this, follow these steps:

  1. Open IIS Manager, and then open the Application Pools node.
  2. Right-click PSWS, and then click Advanced Settings.
  3. In the Process Model section, set Maximum Worker Processes to 1.


Resolution 3: The new process cannot access the database when IIS recycles a W3WP.exe process

Use the Disable Overlapped Recycle setting. To do this, follow these steps:

  1. Open IIS Manager, and then open the Application Pools node.
  2. Right-click PSWS, and then click Advanced Settings.
  3. In the Recycling section, set Disable Overlapped Recycle to True.

References


For more information about ESE, see the following Microsoft Docs article:

Extensible Storage Engine

For more information about Version Store settings and how to monitor usage, see the following Directory Services Team Blog article:

The Version Store Called, and They’re All Out of Buckets