Xamarin Forms iOS调用Firebase数据库遇505 HTTP版本不支持错误
Xamarin Forms调用Firebase数据库时iOS端出现505 HTTP VersionNotSupported错误
问题现象
- 仅iOS端调用Firebase数据库时触发
505 HTTP VersionNotSupported错误,Android端无此问题 - 错误信息:
StatusCode HttpVersionNotSupported
或
ResponseData "<html>\r\n<head><title>505 HTTP Version Not Supported</title></head>\r\n<body>\r\n<center><h1>505 HTTP Version Not Supported</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n"
相关代码
初始化Firebase客户端:
public FirebaseClient firebase = new FirebaseClient("https://myappname.firebaseio.com/");
数据获取逻辑:
return (await firebase .Child(ChildName) .OnceAsync<Userlogin>()).Select(item => new Userlogin { user_login = item.Object.user_login, passwords = item.Object.passwords }).ToList();
错误堆栈跟踪
StackTrace " at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode () [0x0001b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpResponseMessage.cs:168 \n at Firebase.Databa at Firebase.Database.Http.HttpClientExtensions.GetObjectCollectionAsync[T] (System.Net.Http.HttpClient client, System.String requestUri, Newtonsoft.Json.JsonSerializerSettings jsonSerializerSettings) [0x00134] in <d27c522a7ecc437a9802ee0b4650ca23>:0 "
补充说明
- plist文件已配置HTTPS请求地址
- 服务器提示请求不被接受的原因:使用HTTP或HTTP版本过时,需在iOS端实现更新HTTP版本或强制HTTPS
- 后续更新:问题已定位为项目HTTP设置问题,遗留反序列化问题将另行处理,本问题即将关闭
内容的提问来源于stack exchange,提问作者OnceUponATime
相关产品推荐
相关产品推荐

