Solution: PSI authentication error - 7952

W

whitneje

I have been trying to create an event handler to modify a project using the
project OnCreated method. I created a second console program for testing my
PSI calls before actually creating and uploading the OnCreated dll. The
console app would work fine for testing the code, but whenever I created the
event handler dll it would crash with the following error messages:

Category: Project Server - General
EventID: 7952
Message: Critical PSI Auth: Username 'XX\myuser' passed in is not valid is
project database.

Category: Project Server Server-Side Even
EventID: 6663
Message: Critical Event Handler "AHProjectEvents.ProjectEventHandler" threw
an exception: The request failed with HTTP status 401: Unauthorized.
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at AHProjectEvents.WebSvcProject.Project.ReadProject(Guid projectUid,
DataStoreEnum dataStore)
at AHProjectEvents.ProjectEventHandler.OnCreated(PSContextInfo
contextInfo, ProjectPostEventArgs e)


I beat my head against this problem for 2 days. I was using impersonation,
and my user had all the authority it needed. The event handler was getting
registered. The problem ended up being the following line in my event handler:

bool isWindowsAccount = contextInfo.IsWindowsUser;
ProjectDerived.SetImpersonationContext(isWindowsAccount,
contextInfo.UserName, contextInfo.UserGuid, trackingGuid,
contextInfo.SiteGuid, LANGUAGE_ID);

For some reason contextInfo.IsWindowsUser kept return false even though my
account is a windows user.

SOLUTION:
I change the line to:

bool isWindowsAccount = true;
ProjectDerived.SetImpersonationContext(isWindowsAccount,
contextInfo.UserName, contextInfo.UserGuid, trackingGuid,
contextInfo.SiteGuid, LANGUAGE_ID);

Now it works perfectly. I'm not sure why contextInfo doesn't have the
appropriate information about my account, but hard coding true works for me.
This solution may not work if you are using forms authentication.

I was never able to find out any details about the EventID: 7952. Has anyone
else seen this before? I hope this helps.
 
S

Stephen Sanderlin

It seems to me that the server was trying to search for an FBA user
named 'XX\myuser' because IsWindowsUser was set to false. I'm not sure
why IsWindowsUser would have been false in the ContextInfo when the
triggering user of the event was a Windows User, though.

--
Stephen Sanderlin
Principal Consultant
MSProjectExperts

For Project Server Consulting: http://www.msprojectexperts.com
For Project Server Training: http://www.projectservertraining.com

Read my blog at: http://www.projectserverhelp.com
Join the community at: http://forums.epmfaq.com



I have been trying to create an event handler to modify a project using the
project OnCreated method. I created a second console program for testing my
PSI calls before actually creating and uploading the OnCreated dll. The
console app would work fine for testing the code, but whenever I created the
event handler dll it would crash with the following error messages:

Category: Project Server - General
EventID: 7952
Message: Critical PSI Auth: Username 'XX\myuser' passed in is not valid is
project database.

Category: Project Server Server-Side Even
EventID: 6663
Message: Critical Event Handler "AHProjectEvents.ProjectEventHandler" threw
an exception: The request failed with HTTP status 401: Unauthorized.
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at AHProjectEvents.WebSvcProject.Project.ReadProject(Guid projectUid,
DataStoreEnum dataStore)
at AHProjectEvents.ProjectEventHandler.OnCreated(PSContextInfo
contextInfo, ProjectPostEventArgs e)


I beat my head against this problem for 2 days. I was using impersonation,
and my user had all the authority it needed. The event handler was getting
registered. The problem ended up being the following line in my event handler:

bool isWindowsAccount = contextInfo.IsWindowsUser;
ProjectDerived.SetImpersonationContext(isWindowsAccount,
contextInfo.UserName, contextInfo.UserGuid, trackingGuid,
contextInfo.SiteGuid, LANGUAGE_ID);

For some reason contextInfo.IsWindowsUser kept return false even though my
account is a windows user.

SOLUTION:
I change the line to:

bool isWindowsAccount = true;
ProjectDerived.SetImpersonationContext(isWindowsAccount,
contextInfo.UserName, contextInfo.UserGuid, trackingGuid,
contextInfo.SiteGuid, LANGUAGE_ID);

Now it works perfectly. I'm not sure why contextInfo doesn't have the
appropriate information about my account, but hard coding true works for me.
This solution may not work if you are using forms authentication.

I was never able to find out any details about the EventID: 7952. Has anyone
else seen this before? I hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top