The id 3083129a-f9d5-49f6-8fd4-246be76fd33d is in use.

Apr 20, 2011 at 3:21 PM

I get the exception below, when trying to set properties in a second web application in the same farm.

What am I doing wrong?

Thank you.

Here are the steps to reproduce:

In a console app...

Run the code below with URL1, the property gets sets properly.

Run the code below with URL2, the exception below is thrown.

Drop:

11

My Code:

	   string siteUrl = "http://rio";

            IConfigManager configManager = SharePointServiceLocator.GetCurrent().GetInstance<IConfigManager>();
            
            // Add a new site property or update an existing site property.
            using (SPSite site = new SPSite(siteUrl))
            {
                 configManager.SetWeb(site.RootWeb);
                var webAppPropBag = configManager.GetPropertyBag(ConfigLevel.CurrentSPWebApplication);
                configManager.SetInPropertyBag("MyApplications.WorkgroupName", "Customer Service", webAppPropBag);
            }

 The exception:

Configsetting with key 'MyApplications.WorkgroupName' could not be set 'Customer Service' with type 'System.String'. The technical exception was: System.ArgumentException: The id 3083129a-f9d5-49f6-8fd4-246be76fd33d is in use.  An Microsoft.Practices.SharePoint.Common.Configuration.WebAppSettingStore named "_pnpWebAppConfig_" is using the same id as the new object named "_pnpWebAppConfig_" of type Microsoft.Practices.SharePoint.Common.Configuration.WebAppSettingStore.  Every object must contain a unique id.  Either update the new object's id or delete the existing object and try again.

Apr 26, 2011 at 12:54 AM
Edited Apr 26, 2011 at 1:08 AM

The bug does not occur in my server. I am able to set the same key at WebApp Level for two different WebApps. In the following steps I createe a webapp at port 6666, another webapp at port 7777, and then I created an identical key “ASMLab2.Key” at both webApps but set different value for different webapps. Finally, I retrieved the key value for each webapp in a webpart. The steps use the “SharePoint Guidance 2010 Hands on Lab”.

Steps:

1. Create WebApp 1: http://myserver:6666/
2. Create WebApp 2: http://myserver:7777/
3. Download SharePoint Guidance 2010 Hands On Lab ( http://spg.codeplex.com/releases/view/60343 )
4. Open the VS solution SPG2010.ApplicationSettingsManager.Lab2 (This Lab Add and Remove Application Setting in Console Application and show the value of them in a Web Part )
5. Build the solution and deploy the project ASMLab2.ShowLevelPropertyWebPart in the solution
6. Copy the console application ASMLab2.ConsoleApp.exe from the ASMLab2.ConsoleApp bin folder to C:\
7. Open command prompt to run the next two command:
8. C:\> ASMLab2.ConsoleApp.exe add http://myserver:6666/ spwebapp ASMLab2.Key "port 6666 SPWebApp level value of ASMLab2.Key"
9. C:\> ASMLab2.ConsoleApp.exe add http://myserver:7777/ spwebapp ASMLab2.Key "port 7777 SPWebApp level value of ASMLab2.Key"
10. Create new site page http://myserver:6666/SitePages/ASMLab2Page.aspx and insert the webpart “ShowLevelPropertyWebPart” from Custom category. This web part is available if you deploy ASMLab2.ShowLevelPropertyWebPart to the site at the above step 5.
11. Create new site page http://myserver:7777/SitePages/ASMLab2Page.aspx and insert the webpart “ShowLevelPropertyWebPart” from Custom category.This web part is available if you deploy ASMLab2.ShowLevelPropertyWebPart to the site at the above step 5.
12. In http://myserver:6666/SitePages/ASMLab2Page.aspx   , Select SPWebApplication and Type key ASMLab2.Key and click “Check It”, I can retrieve my value of the key for port 6666.
13. In http://myserver:7777/SitePages/ASMLab2Page.aspx , Select SPWebApplication and Type key ASMLab2.Key and click “Check It”, I can retrieve my value of the key for the port 7777.


Thanks,
Hanz