Error 401 unauthorised when trying to connect to Dynamic nav web service

I am trying to connect to Dynamic nav via web service using a C# client. I added the url in a web reference.

public static List<Customer_Card.Customer_Card> GetCustomersList()

{

Customer_Card.Customer_Card[] Customers = new Customer_Card.Customer_Card[] { }

Customer_Card_Service service = new Customer_Card_Service();

service.Credentials= new System.Net.NetworkCredential("xxxxxx, “xxxxxx”);

Customer_Card_Filter CustomerFilter = new Customer_Card_Filter();

Customers = service.ReadMultiple(new Customer_Card_Filter[] { }, “”, 1000);

}

I am getting the following error :

The request failed with HTTP status 401: Unauthorized.

any help will be appreciated

do you run the c# app on the same server than the nav service (localhost) ?

check firewall settings, switch firewall off, try again.

check credentials (user, pw), if this user is a valid nav user. also try with a different user.

use constructor networkcredential(name, password, domain) instead.

try to use defaultcredentials instead.

no its nit in the same server. However I tried the constructor networkcredential(name, password, domain) and the default credentials too , same issue