XAMARIN.Android WCF方法调用未完成

时间:2018-04-04 17:59:56

标签: c# android wcf xamarin

我有一个Visual Studio 2017 Xamarin表单,其上有一个按钮,单击该按钮将执行返回数字的WCF方法。该应用程序在UWP中正常工作,应用程序从WCF调用接收号码。在Android(模拟器)上虽然该方法已执行但从未完成。我运行wireshark甚至在Web服务器上的跟踪日志中看到接收到呼叫并且数据被返回到运行模拟器的计算机,但是应用程序表现得还在等待。我确实在Android应用程序的项目属性中选择了Internet权限。代码如下。您可以看到有一个调试日志之前和之后的条目。 “更新前数据”条目将写入调试日志,但“过去更新数据”条目不会写入。并没有抛出任何错误。谢谢你的帮助。

      private async void LoginButton_Click(object sender, EventArgs ea)
    {

        System.Diagnostics.Debug.WriteLine("before update data");



        Task.Run(() => 
      UpdateData().ConfigureAwait(continueOnCapturedContext:false)); 



        System.Diagnostics.Debug.WriteLine("past update data");
    } 

这是我按下按钮后的调试信息。

Thread started: <Thread Pool> #2
Thread started: <Thread Pool> #3
Thread started: <Thread Pool> #4
Thread started: <Thread Pool> #5
04-05 06:39:22.845 D/Mono    (11093): DllImport attempting to load: '__Internal'.
04-05 06:39:22.845 D/Mono    (11093): DllImport loaded library '(null)'.
04-05 06:39:22.845 D/Mono    (11093): DllImport searching in: '__Internal' ('(null)').
04-05 06:39:22.845 D/Mono    (11093): Searching for 'monodroid_get_system_property'.
04-05 06:39:22.845 D/Mono    (11093): Probing 'monodroid_get_system_property'.
04-05 06:39:22.845 D/Mono    (11093): Found as 'monodroid_get_system_property'.
04-05 06:39:22.846 D/Mono    (11093): DllImport searching in: '__Internal' ('(null)').
04-05 06:39:22.846 D/Mono    (11093): Searching for 'monodroid_free'.
04-05 06:39:22.846 D/Mono    (11093): Probing 'monodroid_free'.
04-05 06:39:22.846 D/Mono    (11093): Found as 'monodroid_free'.
[0:] before update data
04-05 06:39:23.313 D/Mono    (11093): Image addref Mono.Security[0x86f7ce20] -> Mono.Security.dll[0x860aa200]: 2
04-05 06:39:23.313 D/Mono    (11093): Prepared to set up assembly 'Mono.Security' (Mono.Security.dll)
Loaded assembly: Mono.Security.dll [External]04-05 06:39:23.313 D/Mono    (11093): Assembly Mono.Security[0x86f7ce20] added to domain RootDomain, ref_count=1

04-05 06:39:23.314 D/Mono    (11093): AOT: image 'Mono.Security.dll.so' not found: dlopen failed: library "/data/app/com.companyname.SampleClient -1/lib/x86/libaot-Mono.Security.dll.so" not found
04-05 06:39:23.314 D/Mono    (11093): AOT: image '/usr/local/lib/mono/aot-cache/x86/Mono.Security.dll.so' not found: dlopen failed: library "/data/app/com.companyname.SampleClient-1/lib/x86/libaot-Mono.Security.dll.so" not found
04-05 06:39:23.314 D/Mono    (11093): Config attempting to parse: 'Mono.Security.dll.config'.
04-05 06:39:23.314 D/Mono    (11093): Config attempting to parse: '/usr/local/etc/mono/assemblies/Mono.Security/Mono.Security.config'.
04-05 06:39:23.314 D/Mono    (11093): Assembly Ref addref System[0x874de1a0] -> Mono.Security[0x86f7ce20]: 2
04-05 06:39:23.314 D/Mono    (11093): Assembly Ref addref Mono.Security[0x86f7ce20] -> mscorlib[0x9c6e9160]: 47
04-05 06:39:23.411 D/Mono    (11093): Assembly Ref addref Mono.Android[0x9c6e9be0] -> System[0x874de1a0]: 12
04-05 06:39:23.511 D/Mono    (11093): Image addref System.ServiceModel.Internals[0x858bf300] -> System.ServiceModel.Internals.dll[0x860a9300]: 2
04-05 06:39:23.512 D/Mono    (11093): Prepared to set up assembly 'System.ServiceModel.Internals' (System.ServiceModel.Internals.dll)
04-05 06:39:23.512 D/Mono    (11093): Assembly System.ServiceModel.Internals[0x858bf300] added to domain RootDomain, ref_count=1
04-05 06:39:23.512 D/Mono    (11093): AOT: image 'System.ServiceModel.Internals.dll.so' not found: dlopen failed: library "/data/app/com.companyname.SampleClient-1/lib/x86/libaot-System.ServiceModel.Internals.dll.so" not found
04-05 06:39:23.512 D/Mono    (11093): AOT: image '/usr/local/lib/mono/aot-cache/x86/System.ServiceModel.Internals.dll.so' not found: dlopen failed: library "/data/app/com.companyname.SampleClient-1/lib/x86/libaot-System.ServiceModel.Internals.dll.so" not found
04-05 06:39:23.512 D/Mono    (11093): Config attempting to parse: 'System.ServiceModel.Internals.dll.config'.
04-05 06:39:23.512 D/Mono    (11093): Config attempting to parse: '/usr/local/etc/mono/assemblies/System.ServiceModel.Internals/System.ServiceModel.Internals.config'.
04-05 06:39:23.512 D/Mono    (11093): Assembly Ref addref System.Runtime.Serialization[0x874dfe20] -> System.ServiceModel.Internals[0x858bf300]: 2
04-05 06:39:23.513 D/Mono    (11093): Assembly Ref addref System.ServiceModel.Internals[0x858bf300] -> mscorlib[0x9c6e9160]: 48
Loaded assembly: System.ServiceModel.Internals.dll [External]
04-05 06:39:23.601 D/Mono    (11093): Assembly Ref addref System.ServiceModel.Internals[0x858bf300] -> System.Xml[0x874de560]: 6
04-05 06:39:23.602 D/Mono    (11093): Assembly Ref addref System.Runtime.Serialization[0x874dfe20] -> System[0x874de1a0]: 13
04-05 06:39:23.728 D/Mono    (11093): DllImport searching in: '__Internal' ('(null)').
04-05 06:39:23.728 D/Mono    (11093): Searching for 'java_interop_jnienv_call_int_method'.
04-05 06:39:23.728 D/Mono    (11093): Probing 'java_interop_jnienv_call_int_method'.
04-05 06:39:23.728 D/Mono    (11093): Found as 'java_interop_jnienv_call_int_method'.
Thread started:  #6
Thread started: <Thread Pool> #7

0 个答案:

没有答案