Dynamics NAV 2017 Web Services Authentication

Hello-

 

So I wrote a c# application that inserts records into the Purchase Invoice page. I've exposed my object and it works fine. But I'm having some issues with Authentication. All the samples say use UseDefaultCredentials and I did set that to true and it works fine on my box, which has both client and server all on the box. But when we went to test, they setup a N-tier system and I kept getting 401 Unauthorized errors. So I noticed when I check the checkbox for NTLM in NAV administrator, then it worked fine, but I cannot use NTLM, we need to use Kerberos. So to fix this, I used:

 

_purchaseInvoiceService.UseDefaultCredentials = false;

_purchaseInvoiceService.Credentials = new NetworkCredential(user, profile.Password, _stampConfig.UserField8);

 

Passing in the user, password and domain. Now it works for N-tier, but then I go put the code in my dev box which contains everything on one box and it gets a 401 Unauthorized error again? I change the code back to

_purchaseInvoiceService.UseDefaultCredentials = true;

 

then it works on my box but not in the N-tier system again? I'm a bit confused, how do you authenticate with Kerberos with systems with n-tier and stand alone on one box? I would think passing NetworkCredential should work for both system installs? But it seems if it is all on one box, you have to use UseDefaultCredentials?

 

thanks

Related