Posts tagged Ntlm
Calling SharePoint Services with WCF and Impersonation
Feb 5th
After battling with error 0×80004004 the WCF client I was testing started received a new error.
Could not load file or assembly ‘System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0×80070542)
A search yielded this post, which contained some key information. Interestingly enough, we were seeing the “White Screen” issue on our local instance under similar circumstances: a WCF client calling the list service.
Since the behaviors section is not specifying the clientCredentials, the allowedImpersonationLevel is set to Identification. This means that the server can get the Identity of the user, but it is unable to impersonate the user.
This was almost identical circumstances to our problem except that we were not running in the context of Biztalk. The solution was to allow Impersonation by adding an endpoint behavior.
<endpointBehaviors> <behavior name="ImpersonationBehavior"> <clientCredentials> <windows allowedImpersonationLevel="Impersonation" /> </clientCredentials> </behavior> </endpointBehaviors>
Once this was set the service client began working and it was back to the SharePoint dev races. For more on calling SharePoint Services with WCF check out this post.


