I ran to the above error today assisting another Partner with a custom solution they developed.

Problem

The custom ASP.NET Web application is not configured to use client impersonation. By default, impersonation is disabled in a typical ASP.NET Web application created with Microsoft Visual Studio .NET. Calls to the Microsoft Dynamics CRM Web services must provide valid domain credentials to the Microsoft CRM Web service. If When you do not specify credentials, or when you use impersonation, the correct credentials are not provided to the Microsoft Dynamics CRM Web services and the exception occurs.

 

Resolution

In the Web.config file of the custom ASP.NET Web application, add the following element to the <system.web> element:

<identity impersonate="true"/>

When you set the impersonate attribute of the identity element to true, you configure the application to use client impersonation on each request to the application server.