Error occurred in deployment step 'Add Solution': Operation is not valid due to the current state of the object.

时间:2021-08-16 22:50:02

Sharepoint 部署的时候出现一个错误

Error occurred in deployment step 'Add Solution': Operation is not valid due to the current state of the object.

在Server Manager里面看到错误:

The Service Control Manager tried to take a corrective action (Restart the service) after the unexpected termination of the SharePoint Timer Service service, but this action failed with the following error:
An instance of the service is already running.

通过清除Config可以修复。具体操作如下。

1. Central Administration > Monitoring > Review job definitions > Look for following timer job "Application Server Administration Service Timer Job" > Disable
2. Then open windows administrative services (services.msc), stop SharePoint Timer Service
3. Clear SharePoint Timer configuration cache by following steps mentioned in below:

  %SystemDrive%\ProgramData\Microsoft\SharePoint\Config\GUID

  1. Back up the Cache.ini file. (Make a copy of it. DO NOT DELETE THIS FILE, Only the XML files in the next step)
  2. Delete all the XML configuration files in the GUID folder (DO NOTE DELETE THE FOLDER). Do this so that you can verify that the GUID folders content is replaced by new XML configuration files when the cache is rebuilt. 
    Note When you empty the configuration cache in the GUID folder, make sure that you do NOTdelete the GUID folder and the Cache.ini file that is located in the GUID folder.
  3. Double-click the Cache.ini file.
  4. Change the file content to 1, Type 1, and then click Save on the File menu. (Basically when you are done, the only text in the config.ini file should be the number 1)
  5. On the File menu, click Exit.

4. Start SharePoint Timer Service and give it a few seconds so that the new XML files from the location you deleted then are re-populated.
5. Central Administration > Monitoring > Review job definitions > Look for following timer job "Application Server Administration Service" Timer Job > Enable