How to resolve (401) unauthorized error for SharePoint web service call from Infopath Webbased form? : SharePoint Database Repair Blogs
Published by Jacob Martin on March 7, 2015
We may run into an exception when you call the OoB list web services from the Infopath Webbased SharePoint 2010. This exception is “The remote server returned an error: (401) Unauthorized. The remote server returned an error: (401) Unauthorized.“
NetScaler balances the load in front of the multiple IIS servers and the VIP setup is for the Webapps. However, if the web services which are invoked from each individual server such as from the Infopath Webbased form, it generates an exception. You may have this issue.
Then here are the possibilities that can lead to (401) Unauthorized error. The two major issues may arise when you are using load balancer with the multiple IIS servers and setup the alias or VIP for the webapp are authentication loop back issue and load balancer did not return the local host IP issue. You need to fix both of these in order to make the web services calls successful. Here are the methods to fix them.
Fix (401) Unauthorized error issues and Recovery
1. Authentication loop back issue
The cause behind this issue is 3.5 sp1- to fix this you need to add a key to the registry to disable authentication double look up. To do this you need to set the DisableLoopbackCheck registry entry in the HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLsa registry subkey to 1.
For setting the DisableLoopbackCheck registry entry to 1, you need to follow these steps on the client computer.
- Firstly you need to click the Start, click Run, type regedit, and then click OK.
- This will Locate and then click the following registry subkey: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLsa
- Then you need to Right-click on Lsa, point to New, and then click DWORD Value.
- Then you need to Type DisableLoopbackCheck, and then press ENTER.
- Then Right-click DisableLoopbackCheck, and then click Modify.
- In the Value data box, type 1, and then click OK.
- Then Exit Registry Editor.
- Then Restart the computer
Here is the Microsoft link that you can go through to get the details.
2. Load balancer web service call does not return back to the local server: It seems that the web services are like the web service call fails that calls the call initialized from one of the servers behind the Load balancer that points the web services that uses the VIP alias.
Here are the steps that help to find the IPs and fix it.
Firstly you need to identify the IP for Webapp VIP alias. If your site URL for this http://SharePointWebApp, from where you can identify the IP for it from the IIS server by using the command and the IP which is 22.44.555.66.
C: >ping SharePointWebApp
The pinging sharepoinwebapp.compony.com [22.44.555.66] with 32 bytes of data:
Reply from 22.44.555.66: bytes=32 time=1ms TTL=255
Secondly, then you need to find the IP for the IIS server behind the load balancer that uses the command ipconfig such as the IP is 77.33.99.44.
C:Usersosstst1>ipconfig /all Windows IP Configuration Host Name . . . . . . . . . . . . : xxxxxxxxx Primary Dns Suffix . . . . . . . : na.compony.com Node Type . . . . . . . . . . . . : Peer-Peer IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No DNS Suffix Search List. . . . . . : compony.com …… DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 77.33.99.44(Preferred)
Thirdly you need to add the one line entry into the host file that is located at the
C:WindowsSystem32driversetchost. Add the additional line:
77.33.99.44 SharePointWebApp
Fourthly, you need to flush the DNS Resolver Cache that uses the command and verifies the WebApp VIP IP original value 22.44.555.66 that returns the ping that will be changed to local IIS server that is 77.33.99.44.
C:>ipconfig /flushdns
C: >ping SharePointWebApp
The Pinging sharepoinwebapp.compony.com [77.33.99.44] with 32 bytes of data:
Reply from 22.44.555.66: bytes=32 time=1ms TTL=255
Now the web service will be called by the Infopath Webbased form on SharePointIIS server that will not go back to the load balancer. It will call the web services that are hosted by the same host server. By changing the two settings you should be able to resolve (401) unauthorized error.
Resolution:
If this solution does not solve your problem then you need not to worry when you have SharePoint Repair Tool, it is the powerful tool that effectively scans the damaged database files and repairs it to recover inaccessible objects in MDF database files. It even allows the users to retrieve the share point database like tables, indexes, documents, labels and stored procedures from inaccessible MDF files.
How to resolve (401) unauthorized error for SharePoint
- Firstly launch the SharePoint Recovery Tool you would find an interface. This interface screen displays two options to recover SharePoint data: ‘Complete Repair’ and ‘Document Recovery’ Select as per your requirement.
- If you choose ‘Complete Repair’, the screen will show the options for selecting and searching SQL Server (.MDF) files. Click on ‘Select File’ to select a SharePoint database for repair. If you do not know the actual path of the database which you want to repair, click on the ‘Search File’ to locate the MDF file in a specific drive. After selecting the desired file initiate the scanning process
- After finishing the scan, the software would generate a tree of all SharePoint database tables and will display it in the left pane. You can select the table in the tree and can have the entire preview in the right pane. Then Click on ‘Repair’ to begin repairing for the selected database.
- After clicking on ‘Repair’, this dialog box will appear. Specify the SQL Server name or Instance name and the desired destination path. Click on the ‘Browse’ option to choose the destination path. And select ‘OK’ button.
- Once this process gets completed, you would find a dialog box that displays this message ‘Recovered file saved at the desired location. This shows that Recovery Process has successfully completed’. And select ‘OK’ button.
- You would find another dialog box that asks whether you want to attach the repaired database to the web application. If you click on ‘Yes’ button, the above dialog box will be displayed. In the web application URL type, the name of the corrupt database and SQL Server Instance name. Then Select ‘OK’ button and proceed. When the process gets finished, you would be able to access the repaired database by opening the web application.