I had the same issue in LightSwitch OData Service.
Here is the solution :
Uri uri = new Uri("https://localhost:5487/ApplicationData.svc/");
var container = new MyNameSpace.ApplicationData(uri);
container.Credentials = new NetworkCredential("username", "password");