【发布时间】:2015-08-07 20:39:51
【问题描述】:
我在使用 ftp 连接存储和加载 .xml 文件的统一 webgl 构建时遇到问题。在编辑器和本地 ftp 服务器上一切正常(使用 Xlight)。但是当我构建一个 webgl 解决方案并尝试保存一个 .xml 文件时,我收到以下错误:
> Uncaught abort() at Error
at jsStackTrace (http://localhost:8080/Development/WebGL.js:875:12)
at stackTrace (http://localhost:8080/Development/WebGL.js:889:21)
at abort (http://localhost:8080/Development/WebGL.js:3830852:24)
at _pthread_create (http://localhost:8080/Development/WebGL.js:13183:2)
at __ZN6il2cpp2os10ThreadImpl3RunEPFvPvES2_ [il2cpp::os::ThreadImpl::Run(undefined?F?*, void, void*)] (http://localhost:8080/Development/WebGL.js:3596270:50)
at Array.__ZN6il2cpp2os6Thread3RunEPFvPvES2_ [il2cpp::os::Thread::Run(undefined?F?*, void, void*)] (http://localhost:8080/Development/WebGL.js:3746555:7)
at Object.dynCall_iiii (http://localhost:8080/Development/WebGL.js:3807075:39)
at invoke_iiii (http://localhost:8080/Development/WebGL.js:16008:32)
at Array.__ZN6il2cpp6icalls8mscorlib6System9Threading6Thread15Thread_internalEP12Il2CppThreadP14Il2CppDelegate [il2cpp::icalls::mscorlib::System::Threading::Thread::Thread_internal(Il2CppDelegate?**)] (http://localhost:8080/Development/WebGL.js:2708698:6)
at Object.dynCall_iii (http://localhost:8080/Development/WebGL.js:3813716:38)
我完全不知道这意味着什么或如何远程解决此问题。我对服务器技术的兴趣并不是一直很高,因此非常感谢您对此事的帮助。
这是我目前正在使用的 xml 上传代码:
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://localhost/construct.xml");
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential("name", "password");
string xml = xmlDoc.OuterXml;
byte[] bytes = Encoding.UTF8.GetBytes(xml);
Stream requestStream = request.GetRequestStream();
requestStream.Write(bytes, 0, bytes.Length);
requestStream.Close();
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
response.Close();
如果还有什么我遗漏的,请告诉我。提前致谢!
【问题讨论】:
-
我可能是错的,但 AFAIK 你不能在从 Unity 导出的 HTML5 游戏中使用 WebRequest。
-
切换到webgl平台后在编辑器中使用应该是不可能的吧?它在那里工作得很好。但是当我使用统一网络播放器平台并在编辑器中对其进行测试时,它会给出错误消息并拒绝构建到网络播放器,因为它无法识别 webrequestmethods.ftp(它对网络播放器禁用)。
标签: javascript c# xml unity3d ftp