我有一个WinRt Universal App,只使用VS2015CTP Ultimate(没有第三方软件)。 Phone Emulator连接到Azure,但Windows Simulator需要通过Http代理服务器。我不在公司防火墙内。但是,如果我使用Fiddler并让App使用其Http代理服务器,则模拟器可以工作。 我根本不想使用Fiddler,所以我的问题是,如何在没有Fiddler的帮助下让模拟器调用我的Azure移动服务?
我并不认为代码会有所作为,因为手机和Windows都是如此。但是,这是代码,下面是错误。
//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);
}
}
错误:发送请求时发生错误。 &#39; MyUniversal.Windows.exe&#39; (CLR v4.0.30319:沉浸式应用程序 域名):已加载 &#39; C:\ Windows \组件\ GAC_MSIL \ Microsoft.VisualStudio.Debugger.Runtime \ 14.0.0.0__b03f5f7f11d50a3a \ Microsoft.VisualStudio.Debugger.Runtime.DLL&#39 ;. System.Net.WebException:无法解析远程名称: &#39; mymobileservice.azure-mobile.net&#39;在 System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult的 asyncResult,TransportContext&amp;上下文) System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult的 AR) 堆栈跟踪:
类型的第一次机会异常 &#39; System.Net.Http.HttpRequestException&#39;发生在mscorlib.dll中 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)在System.Runtime.CompilerServices.TaskAwaiter
1.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.TaskAwaiter
1.GetResult() 在 Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient.d__4.MoveNext() ---从抛出异常的先前位置开始的堆栈跟踪结束--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)在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.TaskAwaiter
1.GetResult() 在 Microsoft.WindowsAzure.MobileServices.MobileServiceTable.d__41.MoveNext() ---从抛出异常的先前位置开始的堆栈跟踪结束--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)在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.TaskAwaiter
1.GetResult() 在 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.TaskAwaiter
1.GetResult() 在 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()
1.d__5.MoveNext() ---从抛出异常的先前位置开始的堆栈跟踪结束--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)在System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.WindowsAzure.MobileServices.MobileServiceTable
在 MyUniversal.Azure.AzureHelper.d__6.MoveNext()
答案 0 :(得分:0)
基本上我必须运行:Certutil -addStore TrustedPeople请参阅 https://msdn.microsoft.com/en-us/library/windows/desktop/jj835832(v=vs.85).aspx