2

I am having WEB API hosted in IIS and simply it just trying to get credentials from Windows Credentials Manager.

In the debugging environment and IIS Express , this works fine, but when it is hosted in IIS, it simply doesn't show the accessed credential user name.

What IIS has to do with accessing of Windows CredentialManager ? Why Microsoft CredentialManagement Apidon't work perfectly with it.? What do I need to do ? ARe there some settings available in IIS for this?

Following Index method is accessing credentials manager. It fails at credd.Load(), but no exception is being thrown.

 public ActionResult Index()
    {
        //var credential = WindowsCredentialManager.ReadCredential("https://theprojectgroup.atlassian.net/");

        ViewBag.DocumentationProvider = Configuration.Services.GetDocumentationProvider();
        using (var cred = new CredentialManagement.Credential())
        {
            cred.Target = "https://theprojectgroup.atlassian.net/";
            cred.Load();
            var password = cred.Password;
            var userName = cred.Username;

            //ViewBag.Username = userName;
            ViewBag.Username = userName;

            return View(Configuration.Services.GetApiExplorer().ApiDescriptions);
        }
    }
4

0 回答 0