I have been having trouble with Secure Store. When I deploy, or IISRESET my Secure Store works for a few hours, then Secure Store Dies as I get this Error:

System.ServiceModel.EndpointNotFoundException: Secure Store Service did not 
performed the operation. 

System.ServiceModel.EndpointNotFoundException: Secure Store Service did not 
performed the operation. at    Microsoft.Office.SecureStoreService.Server.
SecureStoreServiceApplicationProxy.Execute[T](String operationName, Boolean 
validateCanary, ExecuteDelegate`1 operation) at icrosoft.Office.SecureStoreService.
Server.SecureStoreServiceApplicationProxy.GetCredentials(Guid rawPartitionId, 
String applicationId) at 
GetCredentials(String appId)

I am running out of options, that's why I am asking here.

I have already looking into Nulling objects ... as from what I read here: http://davidlozzi.com/tag/secure-store-service/

Here is my code to retrieve my Secure Store Credentials..

   public static Dictionary<string, string> GetCredentials(string applicationID)
        var credentialMap = new Dictionary<string, string>();
        var serviceContext = SPServiceContext.Current;
        var secureStoreProvider = new SecureStoreProvider { Context = serviceContext };

        using (var credentials = secureStoreProvider.GetCredentials(applicationID))
            var fields = secureStoreProvider.GetTargetApplicationFields(applicationID);
            for (var i = 0; i < fields.Count; i++)
                var field = fields[i];
                var credential = credentials[i];
                var decryptedCredential = ToClrString(credential.Credential);

                credentialMap.Add(field.Name, decryptedCredential);

        serviceContext = null;
        secureStoreProvider = null;
        return credentialMap;

.. But it doesnt seem to work either.

Any Suggestions would be very helpful. Thanks!

1 Answer 1


(for someone who is fighting with the same problem)

In my case (I got the same error description) the https connection (that is used to internal call to SecureStore service) is failed on certificate check. It is strange, but the error does not occur on the first call of SecureStore routines, but later, for example after Session is expired and your code call the Secure Store service the second time.

//my class to get credentials
class SecureStoreAccessProvider
    private Uri SiteUri;
    private Uri AdminSiteUri;
    private bool MyCertHandler(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors error)
        // Ignore errors
        if (sender is HttpWebRequest)
            HttpWebRequest request = (HttpWebRequest)sender;

            if (SiteUri.Host.Equals(request.RequestUri.Host) || AdminSiteUri.Host.Equals(request.RequestUri.Host))
                return true; //alway 'true' reslut
        return SslPolicyErrors.None.Equals(error);

    /// <summary>
    /// ctor
    /// </summary>
    public SecureStoreAccessProvider()
        SiteUri = new Uri(SPContext.Current.Web.Url);
        AdminSiteUri = new Uri (GetCentralAdminSite().Url);
        ServicePointManager.ServerCertificateValidationCallback += MyCertHandler;

        ServicePointManager.ServerCertificateValidationCallback -= MyCertHandler;

    public IAppSecuredCredentials GetCredentials(string appId)
        //here the similar code like yours

   //I have found this function in MSDN sample
   public static SPSite GetCentralAdminSite()
        SPAdministrationWebApplication adminWebApp = SPAdministrationWebApplication.Local;
        if (adminWebApp == null)
            throw new InvalidProgramException("Unable to get the admin web app");

        SPSite adminSite = null;
        Uri adminSiteUri = adminWebApp.GetResponseUri(SPUrlZone.Default);
        if (adminSiteUri != null)
            adminSite = adminWebApp.Sites[adminSiteUri.AbsoluteUri];
            throw new InvalidProgramException("Unable to get Central Admin Site.");

        return adminSite;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.