In this post, we will explain how to solve “An entry with the same key already exists” that you may face when creating a new service application in SharePoint 2016 and 2013.
You might also like to read Install and Configure Project Server 2016 step by step
In SharePoint and Project Server 2013, I have removed a PWA Instance in Project Server Application Service using Central Administration that has been deleted successfully.
But when I tried to recreate a new one with the same details of the previously deleted instance. I got the below error:
Sorry, something went wrong An entry with the same key already exists.
Cause
The “Sorry, something went wrong An entry with the same key already exists.” usually occurs because the configuration details of the PWA instance that have been deleted are still stored in Project Server Application Service configuration.
Therefore, you can’t create a new PWA Instance with the same details of the previously deleted instance till removing and clearing the existing orphaned.
In this section, we will show how to delete orphaned sites SharePoint 2013 using PowerShell.
Steps
- Run SharePoint Management Shell as administrator,
- Run the below cmdlet to get the Project Server application service details assigned to $serviceapp object.
$serviceapp = get-spserviceapplication | ? {$_.TypeName –like "*Project*"}
- Call object $serviceapp to list all PWA application services with its related id.
$serviceapp
- If you have configured more than one PWA application services. In this case, you should get the PWA Application service ID that hosted the deleted PWA instance using the below cmdlet.
$serviceapp = get-spserviceapplication | ? {$_.Id –eq "Service ID"}
- Define a new object to hold all Site Collections/instances related to Project Server application service.
$pwainst = $serviceapp.Sitecollection
$pwainst
- After calling “$pwainst” object, the output should show all instances details within the Project Server application service as shown below.
Although I didn’t provision any PWA instances yet, I got instance details, and that means the configuration details of the deleted PWA instance is still stored in the Project Server application service configuration.
- Copy the Site Id, then paste it to the following command to remove its orphaned.
$siteid = $pwainst | ? {$_.siteId –eq ""}
$siteid
$siteid.Delete()
- Again, Call “$pwainst” object to ensure that all orphaned has been cleared.
- Go back to provision a new PWA instance that should be now worked properly.
Applies To
- SharePoint 2016.
- SharePoint 2013.
thank you.
You are welcome
awesome !
This very useful thanks
Cleaver blogger,please go on and don’t stop
thanks
You save my day thanks