1

I am working on an event receiver in SP2010 environment. It is a 2 sp servers and 1 SQL topology. Both sp servers run exactly same services and service applications. Both have MS office installed. There are 2 AAM setup http://server01 (default) and http://server02. (intranet)

In the event receiver I need to call the excelservice. In Visual studio 2010 I add a web reference URL "http://server01/_vti_bin/excelservice.asmx". After deploy the solution and tested on "http://server01/sites/abc/xxxxx". The program is working as expected.

However, when test with "http://server02/sites/abc/xxxxx". My program logged an error "The request failed with HTTP status 401: Unauthorized.". The event receiver is triggered by a site collection admin account.

I have two findings:

  1. Login server01 and server02, open the browser and browse "http://server01/_vti_bin/excelservice.asmx", both server's browser is returning correct result.
  2. On server02, I added a record in HOSTS file "hkserver01 127.0.0.1" on hkserver02 to force the web service request go locally, my program will work.

So it seems my program will not work "cross-server" or the web service will return 401 for non-local request. Why?

  • We are having the same problem and we are working on a solution, if we get something I will let you know. – Marco Nov 22 '16 at 13:13
  • I think it can easily work around by setup a new AAM like sharepoint.com, then configure HOSTS file with "sharepoint.com 127.0.0.1" on both WFE. However why web service reference do not allow non-local request? – Mark L Nov 23 '16 at 2:46
  • 1
    My scenario is as follows: 1 site providers.sps.local, 1 site documents.sps.local I have a web service into providers that try to get data from documents using CSOM with credentials. When the csom try to connect to documents i get 401 error. Now I make a test using machine name and I succesfully get data – Marco Nov 23 '16 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.