I'm using a Visual Studio web setup project to install an application that extends the functionality of Project Server. I want to call a method from the PSI (Project Server Interface) from one of the custom actions of my setup project, but every time a get a "401 Unauthorized access" error. What should I do to be able to access the PSI. The same code when used from a Console Application works without any issues.
It sounds like in the console situation you are running with your current user credentials, which have access to the PSI. When running from the web, it's running with the creds of the IIS application instance. I think you'd either need to set up delegation to pass the session creds to the IIS application, or use some static creds for your IIS app that have access to the PSI.
I am not running anything from the web, I'm calling the method from an installer custom action, that runs from inside the msi.
I finally found the answer. You can call the LoginWindows PSI service an set the credentials to NetworkCredentials using the appropriate user, password and domain tokens. Then you can call any PSI method, as long as the credentials are explicit. Otherwise, using DefaultCredentials you'll get an Unauthorized Access error, because an msi is run with Local System Account.