之后,从服务器与Exchange Web服务的身份验证我有一个程序,我想在本地网络上使用以下设置:建立模拟环境
Silverlight Client App -> Web Server (data objects etc) | -> Exchange
| -> SQL Database
其他一切工作正常,我可以从数据DB等(可能值得注意的是,我正在使用SQL身份验证而不是Windows身份验证),但是当我尝试从使用Exchange Web服务的交换获取当前用户的日历条目时,它给我一个401 unauthorised
错误。
这些都运行在使用默认ApplicationPoolIdentity的传统ASP.NET 4应用程序池下运行的本地开发服务器上(在我的机器上)。我不通过SSL进来,刚刚超过81端口
我可以连接到得到我自己日历项,但其他用户我得到的错误
如果我尝试没有模拟代码,我得到一个Connection did not succeed. Please try again later
错误,因为我假设EWS将使用没有域登录的ApplicationPoolIdentity。
我用下面的代码来模拟(暂时忽略任何可能未处理的异常/安全漏洞,我只是想获得它的工作!):
var impersonationContext = ((System.Security.Principal.WindowsIdentity)System.Threading.Thread.CurrentPrincipal.Identity).Impersonate();
// Use default credentials
service.UseDefaultCredentials = true;
// Get the target folder ID using the email address
var folder = new FolderId(WellKnownFolderName.Calendar, new Mailbox(emailAddress));
// Get the appointments
var response = service.FindAppointments(folder, view);
impersonationContext.Undo();
// Return list of appointment entities
return response.Items;
望着System.Security.Principal.GetCurrent()
显示用户更改在调用Impersonate
方法后,我想要模拟的用户的身份。 AuthenticationType是Kerberos
而ImpersonationLevel
是Impersonate
。据我可以看到这应该工作,但它看起来像我的网络服务器不想成功授权与交流。
我是否在我的设置或交换中丢失了某些东西?
据我所知,因为“服务器跳”,如果你有Kerberos委派这只会工作为您的服务器启用。 –