Issue: Getting below error, when you are deploying solution to the central administration using power shell.
Add-SPSolution : A solution with the same name “custompackage.wsp” or id “11a39cb8-be0b-4b54-be16-da5ab08a2ae9″ already exists in the solution store.
At line:1 char:15
+ add-spsolution <<<< C:\custompackage.wsp
+ CategoryInfo : InvalidData: (Microsoft.Share…dletAddSolution: SPCmdletAddSolution) [Add-SPSolution], ArgumentException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletAddSolution
If there is any WSP already deployed with the same name, then retract the existing solution from central admin and remove the solution.
If there is no WSP deployed with the same name or if you want to create a new WSP for existing WSP package with different feature name then follow below steps.
1. Open “CustomPackage” solution in Visual Studio.
2. Generate new GUID
3. Modify GUID value “Assembly.Info” with newly generated value.
4. Open feature and renamed feature name and description as you required
5. Open package file and renamed package name
6. Generate new GUID
7. Close the “CustomPackage” solution.
8. Open CustomPackage.csproj file in notepad and updated “<PackageId>” value with newly generated value.
9. Open package.package file in notepad and modified “Id” and “solutionId” attributes with newly generated value
10. Open “CustomPackage” solution in Visual Studio and generate package for “CustomPackage” Project.
Now deploythe new WSP, it will work.
Creating Custom Claims
1. Create a .NET Class library project
2. Add “System.ServiceModel” name space to the class ( using System.ServiceModel;)
3. Inherit ServiceAuthorizationManager class. E.g. below public class Class1 : ServiceAuthorizationManager
4. Override CheckAccess method
5. Write your own custom logic. You can add logic for windows account validation and client certificate validation.
6. Windows account validation a. You can get user account using “OperationContext.ServiceSecurityContext”, you can validate the user with your custom logic.
7. Client certificate validation a. You can get client certificate details using “ServiceSecurityContext.Current.AuthorizationContext”, it contains “X509CertificateClaimSet” objects. By reading certificate object you can get client certificate details.
Configuring changes to web.config
1. Open web.config of WCF service
2. Add below entry in the <behavior> section (Path: configuration\system.serviceModel\behaviors\serviceBehaviors\behavior) <serviceAuthorization serviceAuthorizationManagerType=”ClassLibrary1.Class1, ClassLibrary1″>
3. Save the web.config
Changes to Service Configuration
1. Open IIS Manager
2. Open WCF configured site
3. If you are making custom windows account authentication then enable windows authentication to your service.
4. If you are making custom client certificate based authentication then enable anonymous authentication
5. Make your service as HTTPS, and make required SSL setting to Required.