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);
        }
    }
Usman
  • 2,742
  • 4
  • 44
  • 82
  • Please check your application pools advanced setting in IIS. I am afraid i do not know the english key-names. Under 'Process model' (or similar) 'Load Profile'=True - not sure if 'Identity' needs configuration. Sorry, im not that into IIS config. I hope i could get you in the right direction though. – nilsK Sep 13 '18 at 14:59
  • Show some code to support your statement of "it just trying to get credentials from Windows Credentials Manager". Maybe you just wrote it wrongly. Keep in mind, that web apps run differently on IIS and IIS Express, https://blog.lextudio.com/web-application-differences-in-visual-studio-and-iis-60fec7e311b3 – Lex Li Sep 13 '18 at 15:42

0 Answers0