gpt4 book ai didi

json - 执行 WebAPI 2 JSON Post 时未找到 HttpRequestBase.GetBufferedInputStream

转载 作者:行者123 更新时间:2023-12-01 17:27:27 24 4
gpt4 key购买 nike

  1. 使用 Visual Studio 创建了 MVC5 WebAPI2 项目
  2. 创建了一个基本的 JSON POST
  3. Post 参数导致 HttpRequestBase.GetBufferedInputStream 未找到失败

适用于:

  1. 带有 Visual Studio 的 Windows

失败:

  1. OSX Xamarin
  2. Gentoo Xamarin

测试应用程序:Mono MVC5 Web API2 Test Case

测试程序:

  1. 在 xamarin 中运行 MVC 应用程序
  2. 加载时页面将向服务器发送 ajax 消息。
  3. a) 服务器失败时将返回 500 错误

    b) console.log 成功后发布参数

    Error: {
    "Message": "An error has occurred.",
    "ExceptionMessage": "Method 'HttpRequestBase.GetBufferedInputStream' not found.",
    "ExceptionType": "System.MissingMethodException",
    "StackTrace": " at System.Web.Http.WebHost.HttpControllerHandler+LazyStreamContent.get_StreamContent () [0x00008] in :0

    at System.Web.Http.WebHost.HttpControllerHandler+LazyStreamContent.CreateContentReadStreamAsync () [0x00000] in :0

    at System.Net.Http.HttpContent+c__async2.MoveNext () [0x00095] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/System.Net.Http/System.Net.Http/HttpContent.cs:159

    --- End of stack trace from previous location where exception was thrown ---

    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61

    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:201

    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170

    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142

    at System.Runtime.CompilerServices.TaskAwaiter`1[System.IO.Stream].GetResult () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:372

    at System.Net.Http.HttpContentExtensions+d__0`1[System.Object].MoveNext () [0x00080] in :0

    --- End of stack trace from previous location where exception was thrown ---

    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61

    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:201

    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170

    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142

    at System.Runtime.CompilerServices.TaskAwaiter`1[System.Object].GetResult () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:372

    at System.Web.Http.ModelBinding.FormatterParameterBinding+d__0.MoveNext () [0x000a5] in :0

    --- End of stack trace from previous location where exception was thrown ---

    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61

    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:201

    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170

    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142

    at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:124

    at System.Web.Http.Controllers.HttpActionBinding+d__0.MoveNext () [0x000a0] in :0

    --- End of stack trace from previous location where exception was thrown ---

    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61

    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:201

    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170

    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142

    at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:124

    at System.Web.Http.Controllers.ActionFilterResult+d__2.MoveNext () [0x0008f] in :0

    --- End of stack trace from previous location where exception was thrown ---

    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61

    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:201

    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170

    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142

    at System.Runtime.CompilerServices.TaskAwaiter`1[System.Net.Http.HttpResponseMessage].GetResult () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:372

    at System.Web.Http.Dispatcher.HttpControllerDispatcher+d__1.MoveNext () [0x0018d] in :0 "
    }

最佳答案

在向客户 promise 我可以编写 ASP.NET 5 WepAPI 应用程序并将其部署到他们的 Ubuntu 14.04 服务器中后,我也遇到了这个问题。 耶。

基本上,您需要升级到前沿版本才能正确支持此功能。在 Ubuntu 上,您可以使用官方 nightlies 存储库。但请注意,在 Ubuntu 上,您可能需要使用 dpkg 列出所有已安装的软件包并对 mono 执行 grep 操作,并确保完全清除以前的安装(手动安装和软件包安装) -经理安装类似)。您将会遇到此问题,特别是如果您是从源代码安装的。

同样,在 Ubuntu 环境中,您可以使用 whereis mono 来追踪它可能存在的任何地方。必须这样做,因为否则会发生冲突,因为您的 ENV 中将有多个版本的单声道竞争。

对于 OSX 和其他平台,您可以找到官方信息和 nightlies here 的链接。 .

同样,对于 Ubuntu,以下是如何将二进制 nightlys 添加到源中的方法:

echo "deb http://download.mono-project.com/repo/debian nightly main" | sudo tee /etc/apt/sources.list.d/mono-nightly.list
sudo apt-get update

关于json - 执行 WebAPI 2 JSON Post 时未找到 HttpRequestBase.GetBufferedInputStream,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34033977/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com