locked
Iphone Application with Azure backend, DNS issues RRS feed

  • Question

  • I have an iPhone app with an Azure Web Services virtual machine as backend. The machine uses Windows 2008 server with WAMP installed to serve requests.
    From time to time, the machine doesn't respond to requests done from my app. It doesn't work for 10 to 2 minutes then it works again and so on.

    I use this code to connect to the server:

        NSString *Url_String = [NSString stringWithFormat:@"%@%@",Main_URL,Get_Data_URL];
        NSString *Post_String = Post_String = [NSString stringWithFormat:@"time=%d",0];
        NSMutableURLRequest *Request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:Url_String]];
        [Request setHTTPMethod:@"POST"];
        [Request setHTTPBody:[Post_String dataUsingEncoding:NSUTF8StringEncoding]];
        NSURLConnection* Connection = [NSURLConnection connectionWithRequest:Request delegate:self];
        
    In the method : 

        - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{
        NSLog(@"Unable to connect to server - Error %@",error);
        NSLog(@"%@",[[connection currentRequest] URL]);

    The following appears :

        Unable to connect to server - Error Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo=0x11558f230 {NSUnderlyingError=0x11561a450 "A server with the specified hostname could not be found."

    A few things to mention:  
    - If I connect via the ip of the machine everything works perfectly.  
    - The error appears only on WIFI. On 3G it works perfectly.  
    - I have tried to use both my website domain name bought from GoDaddy by trying to use as Main_Url http://www.applicationame.com and the domain name Azure Web Services adress http://aplication.cloudapp.net  
    - If I retry to connect over and over, no matter the interval between connections, it works at a certain point in time. This time is way to long to work in normal conditions.

    From what I've seen in this http://stackoverflow.com/questions/6573324/nsurlconnection-failure-1003 it seems to be a problem with the DNS not being resolved.

    Does anyone have any insight?
    Monday, June 2, 2014 8:59 PM

Answers

  • Greetings!

    When you say "From browsers all requests to the machine work perfectly", it looks like the VM is working fine as its able to address your HTTP / HTTPS requests.

    We can try deleting and re-creating the Endpoint(s) used by your Mobile App, suspecting the Endpoints to have an issue.

    You may try to RDP into the VM when you suspect any downtime to verify if the VM is up.

    Even if you find this to be a throttling issue, you may consider having a Load Balancer in place after creating another instance.

    Lastly, I'd go with Ming's suggestion of using Mobile Services to be relieved of all infra-related issues.

    Thank you,

    Arvind


    Thursday, October 16, 2014 1:40 PM

All replies

  • Hi,

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.
    Thanks for your understanding!

    Best Regards


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, June 3, 2014 12:36 PM
  • Hi,

    May I know how often you encounter this issue? From Azure side, sometimes the virtual machine may be taken offline for maintenance. To ensure high availability, you need at least two instances of the same virtual machine (for VM, it is needed to manually create 2 instances with proper load balance setting, and add them to the same availability group). Then at least one instance of the VM will be online when the other is under maintenance. Alternatively, you can also use Mobile Services, which solve such infrastructure issue for us automatically.

      >> The error appears only on WIFI. On 3G it works perfectly.  

    I am not sure whether the issue could reside on the device side, for instance, this particular device has malfunctioned under certain wifi networks.

    Best Regards,

    Ming Xu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, June 4, 2014 7:23 AM
  • Hello,

    The issue happens very often (30% of time).

    We have multiple iPhone devices behind the same router so the ip address is the same for all so it might be a throttle somewhere. Was thinking the throttle is in azure because a lot of connections are done from the same ip.

    It seems when we change it it works for a while then it starts again.

    From browsers all requests to the machine work perfectly.

    Wednesday, June 11, 2014 9:14 AM
  • Can you clarify if you are using Windows Server 2008 or Windows Server 2008 R2?
    Friday, June 13, 2014 6:25 PM
  • Windows Server 2008 R2 Datacenter
    Monday, June 30, 2014 12:48 PM
  • Hi,

    I have exactly the same issue there with Azure machine - "host not found" error while connecting to backend server from time to time, less than 30% failed requests, but nevertheless very often. Do you have any progress on solving it?

    Monday, August 11, 2014 1:29 AM
  • Greetings!

    When you say "From browsers all requests to the machine work perfectly", it looks like the VM is working fine as its able to address your HTTP / HTTPS requests.

    We can try deleting and re-creating the Endpoint(s) used by your Mobile App, suspecting the Endpoints to have an issue.

    You may try to RDP into the VM when you suspect any downtime to verify if the VM is up.

    Even if you find this to be a throttling issue, you may consider having a Load Balancer in place after creating another instance.

    Lastly, I'd go with Ming's suggestion of using Mobile Services to be relieved of all infra-related issues.

    Thank you,

    Arvind


    Thursday, October 16, 2014 1:40 PM