0
votes

I have a WinRt Universal App, and only using VS2015CTP Ultimate (no 3rd party software). The Phone Emulator connects to Azure but the Windows Simulator needs to go through an Http proxy server. I am not inside a corporate firewall. However, if I use Fiddler and have the App use its Http proxy server then the Simulator works. I'd like to not use Fiddler at all, so my question is, how do I get the Simulator to make calls to my Azure mobile service without the aid of Fiddler?

I didn't think the code would make a difference as it's the same for both phone and Windows. However, here is the code, and below that is the error.

    //In Appl.xaml, VS2015 creates this code:

public static Microsoft.WindowsAzure.MobileServices.MobileServiceClient myMobileClient = 
new Microsoft.WindowsAzure.MobileServices.MobileServiceClient(
"https://nameofmobileservice.azure-mobile.net/",
"***************************");


//I added:

private IMobileServiceTable<MyResultData> GetMyResultDataTable()
        {
            IMobileServiceTable<MyResultData> myResultDataTable = null;
            try
            {
                myResultDataTable = App.myMobileClient.GetTable<MyResultData>();
            }
            catch (System.Exception e)
            {

                System.Diagnostics.Debug.WriteLine(e.InnerException);
            }
            return myResultDataTable;
        }


//This is the call that fails in Windows simulator, but works in phone emulator:

 public async Task InsertTacticResultData(MyResultData data)
        {
            IMobileServiceTable<MyResultData> myResultDataTable = GetMyResultDataTable();
   try
            {
                await myResultDataTable.InsertAsync(data);
            }
            catch (System.Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.StackTrace);
                System.Diagnostics.Debug.WriteLine(e.Message);
                System.Diagnostics.Debug.WriteLine(e.InnerException);
            }
        }

Error: An error occurred while sending the request. 'MyUniversal.Windows.exe' (CLR v4.0.30319: Immersive Application Domain): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.DLL'. System.Net.WebException: The remote name could not be resolved: 'mymobileservice.azure-mobile.net' at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context) at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar) Stack trace:

A first chance exception of type 'System.Net.Http.HttpRequestException' occurred in mscorlib.dll at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient.<SendRequestAsync>d__1d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient.d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.WindowsAzure.MobileServices.MobileServiceTable.<>c__DisplayClass10.<<InsertAsync>b__f>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.WindowsAzure.MobileServices.MobileServiceTable.d__41.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.WindowsAzure.MobileServices.MobileServiceTable.<InsertAsync>d__17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.WindowsAzure.MobileServices.MobileServiceTable1.<TransformHttpException>d__38.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.WindowsAzure.MobileServices.MobileServiceTable1.<InsertAsync>d__b.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.WindowsAzure.MobileServices.MobileServiceTable
1.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at MyUniversal.Azure.AzureHelper.d__6.MoveNext()

1
What is your code? What is the error? Do you have a virus scanner that might be affecting this? Does it work if you run it local rather than through the emulator? The emulator is just a Remote Desktop session whereas the phone is an actual Hyper-v instance with a virtual NIC.WiredPrairie
I added code and error. The Simulator can do regular calls through the browser. Not sure what you mean by "local". However, I could run it as an ASP.NET project as described at: msdn.microsoft.com/en-us/library/windows/apps/xaml/…ezaspi
Why do you need to use a proxy?WiredPrairie
Then the code works in the Simulator, which is basically the topic of this post - why do I need the proxy?ezaspi
One debugging target option is "Local Machine". Have you tried that instead of the Simulator? The DNS/name resolution is failing according to the stack you posted.WiredPrairie

1 Answers

0
votes