为什么我的 Xamarin iOS 中的 WebRequest 在 ipv6 环境中失败?

2023-11-30

我设置了本地ipv6环境如下https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandandPreparingfortheIPv6Transition/UnderstandandPreparingfortheIPv6Transition.html#//apple_ref/doc/uid/TP40010220-CH213-SW1

我有一个非常简单的 iOS Xamarin 项目,我什么也不做,除了:

WebRequest req = WebRequest.Create("http://109.68.230.138");
WebResponse response = req.GetResponse(); //exception
var dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();

在第 2 行我得到以下异常。如果有人知道它应该如何表现或如何运行它,那就太好了。我想传递 ipv4 地址仍然是一个常见的用例。

Unhandled Exception:
System.Net.WebException: Error: ConnectFailure (Network is unreachable) ---> System.Net.Sockets.SocketException: Network is unreachable
  at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x000cb] in /Users/builder/data/lanes/3859/b638977c/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Net.Sockets/Socket.cs:1313 
  at System.Net.WebConnection.Connect (System.Net.HttpWebRequest request) [0x001c2] in /Users/builder/data/lanes/3859/b638977c/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Net/WebConnection.cs:195 
   --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00065] in /Users/builder/data/lanes/3859/b638977c/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Net/HttpWebRequest.cs:1025 
  at System.Net.HttpWebRequest.GetResponse () [0x0000e] in /Users/builder/data/lanes/3859/b638977c/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Net/HttpWebRequest.cs:1037 
  at Test.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication application, Foundation.NSDictionary launchOptions) [0x0000d] in /Users/xxx/Projects/Test/iOS/AppDelegate.cs:26 
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3859/b638977c/source/xamarin-macios/src/UIKit/UIApplication.cs:79 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3859/b638977c/source/xamarin-macios/src/UIKit/UIApplication.cs:63 
  at Test.iOS.Application.Main (System.String[] args) [0x00008] in /Users/xxx/Projects/Test/iOS/Main.cs:17 
2016-11-09 09:34:32.194 Test.iOS[763:313310] Unhandled managed exception:
Error: ConnectFailure (Network is unreachable) (System.Net.WebException)
  at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00065] in /Users/builder/data/lanes/3859/b638977c/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Net/HttpWebRequest.cs:1025 
  at System.Net.HttpWebRequest.GetResponse () [0x0000e] in /Users/builder/data/lanes/3859/b638977c/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Net/HttpWebRequest.cs:1037 
  at Test.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication application, Foundation.NSDictionary launchOptions) [0x0000d] in /Users/xxx/Projects/Test/iOS/AppDelegate.cs:26 
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3859/b638977c/source/xamarin-macios/src/UIKit/UIApplication.cs:79 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3859/b638977c/source/xamarin-macios/src/UIKit/UIApplication.cs:63 
  at Test.iOS.Application.Main (System.String[] args) [0x00008] in /Users/xxx/Projects/Test/iOS/Main.cs:17 
 --- inner exception ---
Network is unreachable (System.Net.Sockets.SocketException)
  at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x000cb] in /Users/builder/data/lanes/3859/b638977c/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Net.Sockets/Socket.cs:1313 
  at System.Net.WebConnection.Connect (System.Net.HttpWebRequest request) [0x001c2] in /Users/builder/data/lanes/3859/b638977c/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Net/WebConnection.cs:195 
2016-11-09 09:34:32.195 Test.iOS[763:313310] critical: Stacktrace:

2016-11-09 09:34:32.195 Test.iOS[763:313310] critical: 
Native stacktrace:

2016-11-09 09:34:32.265 Test.iOS[763:313310] critical:  0   libmonosgen-2.0.dylib               0x00000001001abd0c mono_handle_native_sigsegv + 260
2016-11-09 09:34:32.266 Test.iOS[763:313310] critical:  1   libsystem_platform.dylib            0x0000000192eec348 _sigtramp + 52
2016-11-09 09:34:32.266 Test.iOS[763:313310] critical:  2   libsystem_pthread.dylib             0x0000000192ef2450 pthread_kill + 112
2016-11-09 09:34:32.266 Test.iOS[763:313310] critical:  3   libsystem_c.dylib                   0x0000000192d9e3e0 abort + 140
2016-11-09 09:34:32.267 Test.iOS[763:313310] critical:  4   libxamarin-debug.dylib              0x0000000100480d90 _ZL20print_all_exceptionsP10MonoObject + 0
2016-11-09 09:34:32.267 Test.iOS[763:313310] critical:  5   libmonosgen-2.0.dylib               0x00000001001ac59c mono_invoke_unhandled_exception_hook + 100
2016-11-09 09:34:32.267 Test.iOS[763:313310] critical:  6   libmonosgen-2.0.dylib               0x00000001001ab830 mono_handle_exception_internal + 3860
2016-11-09 09:34:32.268 Test.iOS[763:313310] critical:  7   libmonosgen-2.0.dylib               0x00000001001aa910 mono_handle_exception + 40
2016-11-09 09:34:32.268 Test.iOS[763:313310] critical:  8   libmonosgen-2.0.dylib               0x00000001001a1be4 mono_arm_throw_exception + 216
2016-11-09 09:34:32.268 Test.iOS[763:313310] critical:  9   libmscorlib.dll.dylib               0x00000001007a9918 throw_exception + 168
2016-11-09 09:34:32.268 Test.iOS[763:313310] critical:  10  libSystem.dll.dylib                 0x0000000100bbac44 System_Net_HttpWebRequest_EndGetResponse_System_IAsyncResult + 388
2016-11-09 09:34:32.269 Test.iOS[763:313310] critical:  11  libSystem.dll.dylib                 0x0000000100bbacc0 System_Net_HttpWebRequest_GetResponse + 112
2016-11-09 09:34:32.269 Test.iOS[763:313310] critical:  12  libTest.iOS.exe.dylib               0x00000001000770b4 Test_iOS_AppDelegate_FinishedLaunching_UIKit_UIApplication_Foundation_NSDictionary + 276
2016-11-09 09:34:32.269 Test.iOS[763:313310] critical:  13  libmscorlib.dll.dylib               0x0000000100786db4 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 244
2016-11-09 09:34:32.269 Test.iOS[763:313310] critical:  14  libmonosgen-2.0.dylib               0x00000001001ba1dc mono_jit_runtime_invoke + 1772
2016-11-09 09:34:32.270 Test.iOS[763:313310] critical:  15  libmonosgen-2.0.dylib               0x000000010022ad0c do_runtime_invoke + 112
2016-11-09 09:34:32.270 Test.iOS[763:313310] critical:  16  libmonosgen-2.0.dylib               0x000000010022ac68 mono_runtime_invoke + 208
2016-11-09 09:34:32.270 Test.iOS[763:313310] critical:  17  Test.iOS                            0x000000010005c62c _ZL30native_to_managed_trampoline_5P11objc_objectP13objc_selectorPP11_MonoMethodP13UIApplicationP12NSDictionaryPKcSB_SB_SB_ + 692
2016-11-09 09:34:32.270 Test.iOS[763:313310] critical:  18  Test.iOS                            0x000000010005c368 -[AppDelegate application:didFinishLaunchingWithOptions:] + 96
2016-11-09 09:34:32.271 Test.iOS[763:313310] critical:  19  UIKit                               0x0000000199d20100 <redacted> + 400
2016-11-09 09:34:32.271 Test.iOS[763:313310] critical:  20  UIKit                               0x0000000199f30858 <redacted> + 3524
2016-11-09 09:34:32.271 Test.iOS[763:313310] critical:  21  UIKit                               0x0000000199f365c8 <redacted> + 1656
2016-11-09 09:34:32.271 Test.iOS[763:313310] critical:  22  UIKit                               0x0000000199f4ae60 <redacted> + 48
2016-11-09 09:34:32.272 Test.iOS[763:313310] critical:  23  UIKit                               0x0000000199f335ac <redacted> + 168
2016-11-09 09:34:32.272 Test.iOS[763:313310] critical:  24  FrontBoardServices                  0x0000000195a018bc <redacted> + 36
2016-11-09 09:34:32.272 Test.iOS[763:313310] critical:  25  FrontBoardServices                  0x0000000195a01728 <redacted> + 176
2016-11-09 09:34:32.272 Test.iOS[763:313310] critical:  26  FrontBoardServices                  0x0000000195a01ad0 <redacted> + 56
2016-11-09 09:34:32.273 Test.iOS[763:313310] critical:  27  CoreFoundation                      0x0000000193e08278 <redacted> + 24
2016-11-09 09:34:32.273 Test.iOS[763:313310] critical:  28  CoreFoundation                      0x0000000193e07bc0 <redacted> + 524
2016-11-09 09:34:32.273 Test.iOS[763:313310] critical:  29  CoreFoundation                      0x0000000193e057c0 <redacted> + 804
2016-11-09 09:34:32.273 Test.iOS[763:313310] critical:  30  CoreFoundation                      0x0000000193d34048 CFRunLoopRunSpecific + 444
2016-11-09 09:34:32.274 Test.iOS[763:313310] critical:  31  UIKit                               0x0000000199d192b0 <redacted> + 608
2016-11-09 09:34:32.274 Test.iOS[763:313310] critical:  32  UIKit                               0x0000000199d14034 UIApplicationMain + 208
2016-11-09 09:34:32.274 Test.iOS[763:313310] critical:  33  libXamarin.iOS.dll.dylib            0x0000000100514fb4 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 324
2016-11-09 09:34:32.274 Test.iOS[763:313310] critical:  34  libXamarin.iOS.dll.dylib            0x00000001004d61ac UIKit_UIApplication_Main_string___intptr_intptr + 44
2016-11-09 09:34:32.275 Test.iOS[763:313310] critical:  35  libXamarin.iOS.dll.dylib            0x00000001004d616c UIKit_UIApplication_Main_string___string_string + 172
2016-11-09 09:34:32.275 Test.iOS[763:313310] critical:  36  libTest.iOS.exe.dylib               0x0000000100076de0 Test_iOS_Application_Main_string__ + 160
2016-11-09 09:34:32.275 Test.iOS[763:313310] critical:  37  libmscorlib.dll.dylib               0x0000000100786db4 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 244
2016-11-09 09:34:32.275 Test.iOS[763:313310] critical:  38  libmonosgen-2.0.dylib               0x00000001001ba1dc mono_jit_runtime_invoke + 1772
2016-11-09 09:34:32.276 Test.iOS[763:313310] critical:  39  libmonosgen-2.0.dylib               0x000000010022ad0c do_runtime_invoke + 112
2016-11-09 09:34:32.276 Test.iOS[763:313310] critical:  40  libmonosgen-2.0.dylib               0x000000010022d2f0 mono_runtime_exec_main + 832
2016-11-09 09:34:32.276 Test.iOS[763:313310] critical:  41  libmonosgen-2.0.dylib               0x000000010022cf0c mono_runtime_run_main + 764
2016-11-09 09:34:32.276 Test.iOS[763:313310] critical:  42  libmonosgen-2.0.dylib               0x000000010019e7f8 mono_jit_exec + 236
2016-11-09 09:34:32.277 Test.iOS[763:313310] critical:  43  libxamarin-debug.dylib              0x000000010048dcd8 xamarin_main + 2168
2016-11-09 09:34:32.277 Test.iOS[763:313310] critical:  44  Test.iOS                            0x000000010005de50 main + 96
2016-11-09 09:34:32.277 Test.iOS[763:313310] critical:  45  libdyld.dylib                       0x0000000192d185b8 <redacted> + 4
2016-11-09 09:34:32.277 Test.iOS[763:313310] critical: 
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

您不能使用 IPv4 地址文字。这是自动失败和应用程序拒绝,因为这些在纯 IPv6 环境中不起作用。您必须改用主机名。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

为什么我的 Xamarin iOS 中的 WebRequest 在 ipv6 环境中失败? 的相关文章

随机推荐

  • Angular 2 (4)、Webpack 站点无法在 IE 11 中的服务器上运行

    Angular 或 Webpack 中的 IE 是否有一些特殊的开关 因为当我在http 本地主机 端口 有用 另外 当我在服务器上运行它时http server domain mysite 在 Edge 或 Chrome 上它可以工作 但
  • Android:无法实例化活动 ComponentInfo

    我在 Android 开发应用程序时遇到问题 我首先对我的错误进行了研究 发现还有其他人也遇到了像我一样的问题 我阅读了所有评论并尝试了所有方法 但仍然遇到相同的错误 这是我的错误 05 29 12 39 36 701 E AndroidR
  • 为android编译C库,但没有找到符号

    我正在尝试为 android 编译一个简单的 C 库 但生成的库不包含任何符号 对象 我正在使用检查图书馆nm命令 这是 Android mk LOCAL PATH call my dir include CLEAR VARS LOCAL
  • FirebaseUI 在某些地区不适用于 Apple IOS 和 macOS 设备,而在其他地区则适用

    我有一个使用 firebase UI 来登录用户的 Web 应用程序 我们已经将 firebase 配置中的身份验证域替换为运行应用程序的自定义域 并且还尝试切换到signInWithPopup 但社交提供商 Facebook 和 Micr
  • 默认情况下,StatefulWidget 中不会调用 initState 函数

    感谢您的关注 我是颤振的初学者 我不知道为什么initState默认情况下不调用该函数 因为 print list 0 语句没有被运行 import package flutter material dart import main pag
  • 如何重定向并返回 200 状态代码

    我有一个 Rails 应用程序 当用户填写表单时 它会使用新信用卡 ping stripe 完成后 它会重定向回主页 然而 stripe 说我返回 503 我认为这就是代码 而不是 200 我正在执行常规的redirect to root
  • Composer 类映射和加载具有非标准扩展名的文件

    通过composer加载文件时classmap功能是否可以加载具有非标准扩展名的 PHP 文件 例如myFileName stub or myFileName foo 目前似乎还没有加载它们 Composer 目前将包含具有以下扩展名的文件
  • 漂亮的 URL ASP.NET MVC

    如何获得漂亮的网址 如 localhost 8888 News Example post 而不是 localhost 8888 Home Details 2 我的 HomeController 有以下详细信息方法 public Action
  • 重新部署远程 glassfish 货物失败

    我目前正在尝试使用 Cargo 通过 Atlassian 的 Bamboo 在远程 glassfish 3 1 2 上部署应用程序 这是一个开发环境 因此具有不同版本号的相同应用程序每次都会部署在相同的上下文根上 但每次我以 Maven 目
  • 日期选择器 minDate 今天和 maxDate 明年 12 月 31 日

    尝试将日期选择限制在今天和明年 12 月 31 日之间 function public holiday date pick datepicker minDate 0 yearRange 0 1 maxDate hideIfNoPrevNex
  • 如何在Python pandas中从Excel文档中读取数据透视表?

    我有一份 Excel 文档 其中包含体育栏 其中有体育名称和运动员姓名 如果我点击运动名称 运动员的名字就会消失 即运动员的名字是运动名称的子代 Please look at the data below 如果我点击板球 那么 ramesh
  • 如何在 Express 中发送标头 [MEAN]

    我是 Express 的初学者 所以我可能没能正确地提出这个问题 我创建了一个 MEAN 应用程序 其中我将我的frontend and backened 前端运行于port 4200服务器运行于port 3000 作为部署的一部分 我想在
  • python绘图日期轴作为字符串而不是日期

    我想使用 pythonplotly 创建一个条形图 其中 x 轴日期作为字符串 类别 由于某种原因 plotly 不断将字符串转换为日期 我的 x 轴是日期的连续 时间线 而不是我期望的类别 我的问题 如何构建一个条形图 将我的日期作为类别
  • RichTextBox 的只读内容不显示图像

    我遇到过一些奇怪的行为RichTextBox 我希望它是readonly 但是当我使用时它不显示图像richTextBox LoadFile path 加载方法 rtf文件 当它不是readonly文件已正确加载并显示图像 我正在使用 Wi
  • Android折叠工具栏:如何调整文本大小,使其显示全文而不是部分文本

    我正在使用 CollapsingToolbarLayout 我使用以下代码来显示标题 collapsingToolbar CollapsingToolbarLayout findViewById R id collapsing toolba
  • jQuery UI Slider - 禁用轨道上的滑动/启用手柄 mousedown

    我有一个 jQuery UI 滑块 当用户尝试使用轨道滑动时我想禁用它 它应该仅在有人将手柄拖动到某处时才起作用 启用 应禁用单击并尝试拖动滑动来移动手柄 我不确定这是否可以使用来完成unbind or mousedown event 我注
  • MVC 中的简单会员提供程序

    如何从 ASP NET MVC4 中的空 Web 应用程序模板创建简单的会员提供程序 我在谷歌 必应和许多其他网站上搜索了很多 但没有得到关于会员提供商的积极回应 有人可以告诉我会员提供商的基本情况吗 please 我按照以下步骤操作 因此
  • Enter 键上的 JQuery 自动完成操作

    我希望自动完成功能像这样 当用户在文本框中输入内容时 不应发生任何事情 仅当用户完成书写时才应出现自动完成建议列表 在文本框中输入并按回车键 知道如何做到这一点 或者在哪里更改代码 STEP 1
  • 从打开的“FILE*”获取缓冲参数

    在C中 我们可以使用设置vbuf 设置缓冲区 其大小和缓冲模式 我惊讶地发现没有人问如何read这些值 给定一个开放的FILE e g stdout 或用户提供 即 如何实现 getvbuf 例行公事 甚至是其中的一部分 void getv
  • 为什么我的 Xamarin iOS 中的 WebRequest 在 ipv6 环境中失败?

    我设置了本地ipv6环境如下https developer apple com library content documentation NetworkingInternetWeb Conceptual NetworkingOvervie