Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ASP.NET:无法模拟调用方(2-hop?)_Asp.net_Security_Impersonation_Kerberos - Fatal编程技术网

ASP.NET:无法模拟调用方(2-hop?)

ASP.NET:无法模拟调用方(2-hop?),asp.net,security,impersonation,kerberos,Asp.net,Security,Impersonation,Kerberos,我有一个MVC3 Web应用程序,它作为域\用户1帐户运行。此用户在AD集中具有SPN,并且受信任可以进行委派 我希望此应用程序代表调用者访问sharepoint server,并为她/他上载文件。我使用以下代码 Dim request = HttpWebRequest.Create(http://sharepoint.domain.com) request.Method = WebRequestMethods.Http.Head request.PreAuthenticate = True

我有一个MVC3 Web应用程序,它作为域\用户1帐户运行。此用户在AD集中具有SPN,并且受信任可以进行委派

我希望此应用程序代表调用者访问sharepoint server,并为她/他上载文件。我使用以下代码

Dim request = HttpWebRequest.Create(http://sharepoint.domain.com)

request.Method = WebRequestMethods.Http.Head
request.PreAuthenticate = True
Dim identity = New WindowsIdentity(callerName & "@domain.com")
Dim impContext = identity.Impersonate()
'###### At this point identity.ImpersonationLevel is `Impersonate` not `Delegate`

request.Credentials = CredentialCache.DefaultNetworkCredentials
'###### DefaultNetworkCredentials is empty (Username, domain and password are all empty strings)

Dim response As HttpWebResponse

Try
    response = request.GetResponse()
    Return JsonSuccess()
Catch ex As WebException

    '###### I get 401 Unauthorized exception
    Return JsonError(ex.Message)
Finally
    impContext.Undo()
End Try
我的问题是。此时的模拟级别应该是
Impersonate
还是
Delegate
(Sharepoint运行在不同于IIS服务器的计算机上)? 在AD中,我还为sharepoint和HTTP配置了协议转换,因此在发出请求后,
Impersonate
是否应该更改为
Delegate
?我不知道,我们将感谢您的指导


另一个问题是-CredentialCache.DefaultNetworkCredentials不应该至少包含模拟用户的用户名吗?

我在这里找到了答案:

Kerberos在负载平衡的体系结构中不起作用,IIS会退回到NTLM身份验证。由于您无法使用NTLM进行委派,因此任何需要委派的应用程序或服务都无法工作。有关详细信息,请单击以下文章号以在Microsoft中查看该文章

事实就是这样。我现在尝试使用另一台负载不平衡的机器,它可以工作

唯一让我惊讶的是身份的模拟级别仍然是
Impersonate
而不是
Delegate