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.
我正在使用Visual Studio Web安装项目来安装扩展Project Server功能的应用程序。我想从我的安装项目的一个自定义操作中调用PSI(Project Server Interface)中的方法,但每次获得“401 Unauthorized access”错误。我该怎么做才能访问PSI?从控制台应用程序使用时,相同的代码可以正常工作。
2 个解决方案
#1
3
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.
听起来在控制台情况下,您使用当前用户凭据运行,该凭据可以访问PSI。从Web运行时,它正在运行IIS应用程序实例的信誉。我认为您需要设置委派以将会话信用传递给IIS应用程序,或者为可以访问PSI的IIS应用程序使用一些静态信用。
#2
2
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.
我终于找到了答案。您可以使用适当的用户,密码和域令牌调用LoginWindows PSI服务,将凭据设置为NetworkCredentials。然后,只要凭证是显式的,您就可以调用任何PSI方法。否则,使用DefaultCredentials会出现Unauthorized Access错误,因为msi是使用本地系统帐户运行的。
#1
3
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.
听起来在控制台情况下,您使用当前用户凭据运行,该凭据可以访问PSI。从Web运行时,它正在运行IIS应用程序实例的信誉。我认为您需要设置委派以将会话信用传递给IIS应用程序,或者为可以访问PSI的IIS应用程序使用一些静态信用。
#2
2
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.
我终于找到了答案。您可以使用适当的用户,密码和域令牌调用LoginWindows PSI服务,将凭据设置为NetworkCredentials。然后,只要凭证是显式的,您就可以调用任何PSI方法。否则,使用DefaultCredentials会出现Unauthorized Access错误,因为msi是使用本地系统帐户运行的。