質問

When i make that call from iPhone Simulator (iOS 6)

var request = System.Net.HttpWebRequest.Create(url);

I have following error

An exception was thrown by the type initializer for System.Net.WebRequest
Error Initializing the configuration system.
Unrecognized configuration section <system.runtime.remoting> 
 /Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/etc/mono/2.0/machine.config

Stacktrace

  at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00000] in <filename unknown>:0 
  at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0 
  at System.Net.WebRequest..cctor () [0x00000] in <filename unknown>:0 

I doesn't undestand what i must do..

UPDATE

My project have a CORE where are referenced that libraries:

  • Newtnsoft.Json.dll System.Net.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
  • System.Core.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
  • System.Core.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
  • System.Data.Linq.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/) System.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
  • mscorlib.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/) Cirrious.MvvmCross.dll (vnext version)

My iOS Project link CORE Project and have that references:

  • monotouch
  • Cirrious.MvvmCross.dll (vnext version)
  • Cirrious.MvvmCross.Binding.dll (vnext version)
  • Cirrious.MvvmCross.Binding.Touch.dll (vnext version)
  • Newtnsoft.Json.dll
  • Cirrious.MvvmCross.Dialog.Touch.dll (vnext version)
  • Cirrious.MvvmCross.Plugin.DownloadCache.Touch.dll (vnext version)
  • Cirrious.MvvmCross.Plugin.File.Touch.dll (vnext version)
  • Cirrious.MvvmCross.Plugin.Location.Touch.dll (vnext version)
  • Cirrious.MvvmCross.Plugin.ThreadUtils.Touch.dll (vnext version)
  • CrossUI.Touch.dll (vnext version)
  • System.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
  • System.Windows.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
役に立ちましたか?

解決

System.Configuration is not part (neither as an assembly or namespace) of the BCL shipped with Xamarin.iOS.

If you get this error it's because you (somehow) got another System.dll (v2.0 from Mono or MS?) into the simulator and this won't work properly.

Make sure you're referencing only the BCL assemblies from Xamarin.iOS and the problem will go away.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top