I'm developing an intranet site that will use in on-premise. In corporate, users can use this site like OWA they can see their inbox, send mails etc. To achive this I use EWS Managed Api 2.2 to connect Exchange Server (2010_sp1).I am developing with ASPNet MVC 5. I am developing on my computer with IIS 10.0 installed.While I'm developing with IISExpress, there were no problem to connect with default credentials >
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
service.UseDefaultCredentials = true;
I understand that, this is because IIS Express use my credentials as default credentials so there were no error to connect service. But when I run this code with IIS on my computer(with my credentials in Application Pool Identity, using ASPNet Impersonation enabled, Windows Authentication enabled and NEGOTIATE/NTML providers) identities load correct
HttpContext.User.Identity.Name > xxx\billgates
WindowsIdentity.GetCurrent().Name> xxx\billgates
but Exchange service returns in trace these >
<Trace Tag="EwsRequestHttpHeaders" Tid="29" Time="2017-01-02 08:03:04Z">
POST /EWS/Exchange.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
Accept: text/xml
User-Agent: ExchangeServicesClient/15.00.0913.015
Accept-Encoding: gzip,deflate
</Trace>
<Trace Tag="EwsRequest" Tid="29" Time="2017-01-02 08:03:04Z" Version="15.00.0913.015">
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2010_SP1" />
</soap:Header>
<soap:Body>
<m:GetFolder>
<m:FolderShape>
<t:BaseShape>AllProperties</t:BaseShape>
</m:FolderShape>
<m:FolderIds>
<t:DistinguishedFolderId Id="inbox" />
</m:FolderIds>
</m:GetFolder>
</soap:Body>
</soap:Envelope>
</Trace>
<Trace Tag="EwsResponseHttpHeaders" Tid="29" Time="2017-01-02 08:03:04Z">
HTTP/1.1 401 Unauthorized
Server: Microsoft-IIS/7.5
WWW-Authenticate: Negotiate,NTLM
X-Powered-By: ASP.NET
Date: Mon, 02 Jan 2017 08:03:04 GMT
Content-Length: 0
</Trace>
When I use EWEditor(https://ewseditor.codeplex.com/) I saw there is no error with connect with default credentials and when run klist in powershell there are kerberos tickes like>
Server: krbtgt/xxxxx.xxx.xx@xxxxx.xxx.xx KerbTicket Encryption Type: RSADSI RC4-HMAC(NT) End Time: 1/2/2017 21:35:37 Renew Time: 1/9/2017 11:35:37
Server: krbtgt/xxxxx.xxx.xx@xxxxx.xxx.xx KerbTicket Encryption Type: Unknown (18) End Time: 1/2/2017 21:35:37 Renew Time: 1/9/2017 11:35:37
Server: HTTP/posta.xxxxx.xxx.xx@xxxxx.xxx.xx KerbTicket Encryption Type: RSADSI RC4-HMAC(NT) End Time: 1/2/2017 21:35:37 Renew Time: 1/9/2017 11:35:37
Server: HTTP/autodiscover.xxxxx.xxx.xx@xxxxx.xxx.xx KerbTicket Encryption Type: RSADSI RC4-HMAC(NT) End Time: 1/2/2017 21:35:37 Renew Time: 1/9/2017 11:35:37
Server: HTTP/xxxcas2.xxxxx.xxx.xx@xxxxx.xxx.xx KerbTicket Encryption Type: Unknown (18) End Time: 1/2/2017 21:35:37 Renew Time: 1/9/2017 11:35:37
Server: ldap/xxxDC2.xxxxx.xxx.xx@xxxxx.xxx.xx KerbTicket Encryption Type: Unknown (18) End Time: 1/2/2017 21:35:37 Renew Time: 1/9/2017 11:35:37
with these tickets I assume that kerberos works, my first question is that am I right?Can I be sure that these tickets guarantee that keberos works with client access servers?
While search for this problem I saw that this problem very like double hop problem like this blog says>https://blogs.msdn.microsoft.com/dhruvkh/2012/04/15/the-double-hop-dogma/ .Actually my problem is exactly like this post. Like this post recommends I use my account as service account and add SPNS to my account and write that in Application Pool Identity in IIS
SPNs that I used
http/autodiscover.xxxxxx.xxx.xx
http/posta.xxxxxx.xxx.xx
NOTE : I am sure these SPNs not used.
After add spns I also check "Trust this computer for delegation to any service (Kerberos only)." in Delegation tab of my user account.
My other question is that like post suggest on 3. step https://technet.microsoft.com/en-us/library/ff808312(v=exchg.141).aspx should I create an Alternate Service Account instead of using my account?If I have to use ASA,should I add Alternate Service Account Credentials in IIS Application Pool Identity?
Thanks for helping.