【问题标题】:Timeout: WebException when trying to access/debug LocalHost of Azure Functions [Unity] [PlayFab]超时:尝试访问/调试 Azure Functions [Unity] [PlayFab] 的 LocalHost 时出现 WebException
【发布时间】:2021-02-24 14:33:21
【问题描述】:

我正在尝试结合 Unity 在本地调试 Azure Function 脚本,但每次都会出现超时错误。

我这里有一些东西,我不确定是哪一个真正导致了问题...它可能是 Windows 上的设置,与其中一个软件相反。

我在 Unity 2019.4 中构建,并使用 PlayFab,它能够使用 Azure Functions。当我尝试从 Azure 服务器执行脚本时,它运行正常。但是当我尝试使用本地调试运行它时,我得到了WebException: The request timed out System.Net.HttpWebRequest.GetRequestStream(请参阅下面的完整错误)。

这是我正在做的设置:

  • 将 PlayFab 设置为本地调试(通过 VS 代码扩展)(并确认 json 文件是在 temp 文件夹中制作的)
  • Here 安装 Azure Functions Core Tools
  • 从 VS Code 启动 Azure Functions 调试(终端输出显示 localhost 运行正常)

超时错误引用了正确的地址http://localhost:7071/api/CloudScript/ExecuteFunction,正如启动 AzFunc 调试时在 VS 代码终端中确认的那样。

当我将项目克隆到我的 MacBook Pro 时,一切都在本地调试中顺利运行。

因此,因此,我尝试检查以确保端口未被 PowerShell 阻止:netsh firewall show state,并告诉 Windows Defender 不要阻止来自 Unity 或 Code 的任何内容。当我在 PowerShell/CMD 中运行 Netstat -ab 时,我得到:

 Can not obtain ownership information
  TCP    0.0.0.0:7071           DESKTOP-COMPUTER:0      LISTENING
 [func.exe]
  TCP    0.0.0.0:7680           DESKTOP-COMPUTER:0      LISTENING

不知道这是问题还是正常...

我什至不知道还要检查什么。这个问题超出了我的范围。如果有人知道解决方案,或者可以指出正确的方向,我将不胜感激!


以下是我在本地调试时通过 PlayFab 执行 Azure Function 脚本时 Unity 日志中的两个错误:

WebException: The request timed out
System.Net.HttpWebRequest.GetRequestStream () (at <14e3453b740b4bd690e8d4e5a013a715>:0)
PlayFab.Internal.PlayFabWebRequest.Post (PlayFab.Internal.CallRequestContainer reqContainer) (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:319)
Rethrow as WebException: Timeout: WebException making http request to: http://localhost:7071/api/CloudScript/ExecuteFunction
UnityEngine.Debug:LogException(Exception)
PlayFab.Internal.PlayFabWebRequest:Post(CallRequestContainer) (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:332)
PlayFab.Internal.PlayFabWebRequest:WorkerThreadMainLoop() (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:252)
System.Threading.ThreadHelper:ThreadStart()

Timeout: WebException making http request to: http://localhost:7071/api/CloudScript/ExecuteFunction
UnityEngine.Debug:Log(Object)
DemoScript:onPlayFabError(PlayFabError) (at Assets/PlayFabPartySDK/Examples/DemoScript.cs:264)
PlayFab.Internal.<>c__DisplayClass30_0:<QueueRequestError>b__0() (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:395)
PlayFab.Internal.PlayFabWebRequest:Update() (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:480)
PlayFab.Internal.PlayFabHttp:Update() (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabHTTP.cs:364)

【问题讨论】:

  • 一个小更新:使用 Postman,我能够连接到 VS Code 调试器。所以,我怀疑问题可能出在 Unity 或 PlayFab SDK 上。

标签: azure unity3d timeout system.net.webexception playfab


【解决方案1】:

好的,TLDR:问题的答案是并非所有内容都已更新。因此,如果您遇到同样的问题,请更新所有内容

在我的例子中,更具体地说是 Unity 包管理器中的“Visual Studio Code Editor”资产。

我只是想把它扔掉,以防将来有人遇到这样的问题。它可能不是需要升级的特定事物,但请搜索所有相关内容并确保其已更新。不仅仅是大而明显的东西(比如 Unity 或你的 IDE)。幸运的是,在这种情况下,更新开始导致其他问题,在尝试解决这些问题后,我遇到了它。

祝你好运,未来的白痴!

【讨论】:

    猜你喜欢
    • 2016-04-19
    • 2022-08-07
    • 1970-01-01
    • 1970-01-01
    • 2021-12-11
    • 2021-09-30
    • 1970-01-01
    • 2013-03-02
    • 2012-07-06
    相关资源
    最近更新 更多