I stood up a development that featured both Commerce Server 2007 and SharePoint 2010. Within the environment, there is a public site and a private site. The SharePoint public site authenticates with a custom provider for Commerce Server 2007. The SharePoint private site uses windows authentication. Once the public site loaded correctly, I was greeted by the below Authentication Failed Exception on the private site. You can see from the screenshot below that it’s not pretty.

Server Error in '/' Application.  Authentication failed.  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.  Exception Details: System.Runtime.InteropServices.COMException: Authentication failed.   Source Error:  An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.   Stack Trace:     [COMException (0x80040e4d): Authentication failed.  ]     Microsoft.CommerceServer.Interop.Profiles.ProfileServiceClass.GetProfileByKey(String bstrKeyMemberName, Object sValue, String bstrType, Boolean bReturnError) +0     Microsoft.CommerceServer.Runtime.Profiles.Profile..ctor(ProfileContext profileService, String keyName, String keyValue, String profileType) +156     [CommerceProfileSystemException: Failed to retrieve profile.]     Microsoft.CommerceServer.Runtime.Profiles.Profile..ctor(ProfileContext profileService, String keyName, String keyValue, String profileType) +504     Microsoft.CommerceServer.Runtime.Profiles.ProfileContext.GetProfile(String keyName, String keyValue, String profileType) +647     Microsoft.CommerceServer.Runtime.CommerceContext.get_UserID() +744     Microsoft.CommerceServer.Runtime.CommerceDataWarehouseAuthenticationModule.OnPreRequestHandlerExecute(Object sender, EventArgs e) +73     Microsoft.Commerce.Providers.SharePointCommerceDataWarehouseAuthenticationModule.OnPreRequestHandlerExecute(Object sender, EventArgs e) +288     System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171     Version Information: Microsoft .NET Framework Version:2.0.50727.5485; ASP.NET Version:2.0.50727.5491

Unfortunately, the stack trace here doesn’t provide too much direction.

I checked the Event Viewer to try glean some useful information. I found the following event.

This only offered misdirection and confusion as it referenced the Commerce Server in the stack trace, which couldn’t be the case since this site used Windows Authentication. The solution came down to the aspnet:AllowAnonymousImpersonation setting, which was configured to true. Once it was modified to false, the site came up as desired. Below is the working configuration.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s