The request failed with HTTP status 401: Unauthorized

ב- SharePoint , ובכלל ב- asp.net אשר אני פונה לשרת נוסף ואני עובד ב-NTLM  ולא ב- Kerberos, אני אמור להעביר Credential. הבעיה מתחילה, כאשר הזמן לא מספיק, ואז מקבלים שגיאה, שבכלל אומרת שאין לי הרשאות לשרת, למרות שהעברתי את ה Credential.

The request failed with HTTP status 401: Unauthorized

יש שני פתרונות קלים:
האחד, להוסיף זמן ב- Web.Config - Timeout
השני והנכון יותר (לפי דעתי), זה לפנות בThread-  נוסף לשרת המרוחק.
הנה דוגמה לקוד שפונה ב- Thread נוסף. שימו לב, שהגדרתי DefaultCredentials לפני פתיחת ה- Thread.

WSrv.MyService wsrv = new MyService();
wsrv.Credentials = CredentialCache.DefaultCredentials;
System.Threading.Thread t = new System.Threading.Thread(delegate()
{
   resp = wsrv.CallMyWebService(prms);
});
t.Start();
t.Join();

לא מסובך, ועובד.
חג שמח,
רועי ק.

Comments

  1. see the post in english:
    http://iwillsharemypoint.blogspot.com/2011/04/ntlm-problam-request-failed-with-http.html

    ReplyDelete

Post a Comment

Popular posts from this blog

A sharepoint list view of the current month

SharePoint Service Provisioning - the service stuck on starting

The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters