I'm trying to create a simple program that connects to Exchange Server and expands distribution emails. When testing locally or using dev server, I have no trouble connecting to Autodiscover and getting the results but in QA and Prod server I got the error "The autodiscover service couldnt be located". The trace file said "No matching autodiscover dns srv records were found". I tried directly using the uri of the .asmx EWS. It worked locally and in dev but once again that threw an error in QA and PROD "The request failed. Unable to connect to the remote server". I pinged the exchange server from my qa and prod servers successfully. I can't seem to figure out what it is after many hours of searching.
var service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.TraceEnabled = true;
service.TraceFlags = TraceFlags.All;
service.TraceListener = new Entities.DTO.TraceListener();
//service.AutodiscoverURL(autodiscoverURL);
service.URL = new Uri("https://mail.domain.net/EWS/Exchange.asmx");
ExpandGroupResults myGroupMembers = service.ExpandGroup(distributedList);