In this post we will discuss how to resolve error "The remote server returned an error (401) unauthorized" which comes while trying to retrieve data from user profile service.
Also check out:
In an InfoPath form we were trying to retrieve manager details by using UserProfileService (GetUserProfileByName). It was working fine, but suddenly it gave error as:
An error occurred querying a data source.
Click OK to resume filling out the form. You may want to check your form data for errors.
An error occurred while trying to connect to a Web service.
An entry has been added to the Windows event log of the server.
When we check more in the Logs we got the error message saying as:
The remote server returned an error: (401) Unauthorized. The remote server returned an error: (401) Unauthorized.)
Open IIS, Then click on Authentication and then Disable "ASP.NET impersonation".
Hope it will solve the issue.