I have a Xamarin Android App, made with Visual Studio 2017, and a ASMX Web Service.
The Web Service is published and running in the web Sever, the App, when in Debug mode, connects and runs fine without errors.
When I do the APK file and install it in other device I received the following error when trying to log in (First time the app calls the Web Service).
Configuration system failed to initialize
System.TypeInitializationException:
The type initializer for 'System.Uri' threw an exception. --->
System.TypeInitializationException:
The type initializer for 'System.UriParser' threw an exception. --->
System.MissingMethodException:
Method not found: bool System.Runtime.Versioning.BinaryCompatibility.get_TargetsAtLeast_Desktop_V4_5()
--- End of inner exception stach trace ---
at (wrapper managed-to-native)
System.Object.__icall_wrapper_mono_generic_class_init(intptr)
at System.Uri..cctor () [0x00000] in <988fa07610c94365ae6d295a6aa379fe>: 0
--- End of inner exception stach trace ---
at System.Configuration.ConfigurationManager.EnsureConfigurationSystem() [0x00022] in <673a29f4914b4711bafe0a24a4318f71>: 0
I already tried the most common answer for this error without any luck.
<configSections>
<sectionGroup name="applicationSettings"
type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="DCSWhseWS.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
requirePermission="false" />
</sectionGroup>
This is the Web.config I'm using:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings"
type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="DCSWhseWS.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
requirePermission="false" />
</sectionGroup>
</configSections>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.6.1"/>
<httpRuntime maxRequestLength="10240" executionTimeout="1200"/>
<pages controlRenderingCompatibilityVersion="4.0"/>
</system.web>
<connectionStrings>
<add name="ConnString" connectionString="PBlWIpWVxZphTCce55j8P3gOqn3SkHqBx0Mz+F9VDFNMXc+uQ+Blgvg2/dt5W0KjBJe7iDu7C1BNjSxe/f3Vx7aLVBuqLSo41iEzVhXmmShi8LER83ihpN0hbrd8z/XZzwPS0JRqDERPd07SLgWMNg=="/>
<add name="ConnStringTest" connectionString="NpoUd7klEHdHbMERo/Qfq6gv2bakghTNJCMPuX4gIeIYco7297Narru6dSwNJy0TNpaQ67nlCAGEcAAPTPB0O+R1qTqBuysnlkzxiDnrP8ulzR7U4JiekjyZln8Lb8VNKJf/UIK+MDBPIus8gbNUpg=="/>
</connectionStrings>
</configuration>
And this is how I call the Web Service from the Android App:
WhseWS.Whse obj = new WhseWS.Whse();
return JsonConvert.DeserializeObject<clsUser>(obj.Login(UserCode));
Again, this error doesn't happen when I'm debugging the app only when the APK is installed in any device.
Thank you very much for the help!
Aucun commentaire:
Enregistrer un commentaire