Kestrel no Mono Error -14 EFAULT系统调用参数中的错误地址

时间:2017-02-21 16:46:35

标签: c# asp.net-core mono kestrel-http-server

首先,我意识到Aso不再支持或测试AspNetCore。

但是,我有一个现有项目(AspNet 1.0.0-rc1-final),它针对net461,我需要将其迁移到AspNetCore 1.1.0。经过几个小时的挣扎,我做到了,只是因为它不再使用Mono而感到惊讶。

我尝试切换到netcoreapp1.1但在DLL地狱中结束了np - 通过许多不受支持的库来实现它。

我正在使用Docker和Mono以及其他安装的LibUV

FROM debian:wheezy

MAINTAINER Jo Shields <jo.shields@xamarin.com>

#based on dockerfile by Michael Friis <friism@gmail.com>

ENV MONO_VERSION 4.6.2.7

RUN apt-get update \
  && apt-get install -y curl \
  && rm -rf /var/lib/apt/lists/*

RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

RUN echo "deb http://download.mono-project.com/repo/debian wheezy/snapshots/$MONO_VERSION main" > /etc/apt/sources.list.d/mono-xamarin.list \
  && apt-get update \
  && apt-get install -y binutils mono-devel ca-certificates-mono fsharp mono-vbnc nuget referenceassemblies-pcl \
  && rm -rf /var/lib/apt/lists/* /tmp/*


# Install libuv for Kestrel from source code (binary is not in wheezy and one in jessie is still too old)
# Combining this with the uninstall and purge will save us the space of the build tools in the image
RUN LIBUV_VERSION=1.9.1 \
    && apt-get -qq update \
    && apt-get -qqy install autoconf automake build-essential libtool \
    && curl -sSL https://github.com/libuv/libuv/archive/v${LIBUV_VERSION}.tar.gz | tar zxfv - -C /usr/local/src \
    && cd /usr/local/src/libuv-$LIBUV_VERSION \
    && sh autogen.sh && ./configure && make && make install \
    && rm -rf /usr/local/src/libuv-$LIBUV_VERSION \
    && ldconfig \
    && apt-get -y purge autoconf automake build-essential libtool \
    && apt-get -y autoremove \
    && apt-get -y clean \
    && rm -rf /var/lib/apt/lists/*

我的应用的每个http请求都会导致Kestrel错误:

info: Microsoft.AspNetCore.Server.Kestrel[14]
      Connection id "0HL2PMPE1RGS7" communication error.
Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -14 EFAULT bad address in system call argument
info: Microsoft.AspNetCore.Server.Kestrel[20]
      Connection id "0HL2PMPE1RGS7" request processing ended abnormally.
System.IO.IOException: Error -14 EFAULT bad address in system call argument ---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -14
EFAULT bad address in system call argument
   --- End of inner exception stack trace ---
  at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.SocketInput.CheckConnectionError () [0x00020] in <43555eec0dc34d2abb4f01227fa5a2e9>:0
  at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.SocketInput.GetResult () [0x00013] in <43555eec0dc34d2abb4f01227fa5a2e9>:0
  at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1+<RequestProcessingAsync>d__2[TContext].MoveNext () [0x00194] in <43555eec0dc34d2abb4f01227fa5a2e9
>:0
info: Microsoft.AspNetCore.Server.Kestrel[14]
      Connection id "0HL2PMPE1RGS8" communication error.
Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -14 EFAULT bad address in system call argument
info: Microsoft.AspNetCore.Server.Kestrel[20]
      Connection id "0HL2PMPE1RGS8" request processing ended abnormally.
System.IO.IOException: Error -14 EFAULT bad address in system call argument ---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -14
EFAULT bad address in system call argument
   --- End of inner exception stack trace ---
  at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.SocketInput.CheckConnectionError () [0x00020] in <43555eec0dc34d2abb4f01227fa5a2e9>:0
  at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.SocketInput.GetResult () [0x00013] in <43555eec0dc34d2abb4f01227fa5a2e9>:0
  at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1+<RequestProcessingAsync>d__2[TContext].MoveNext () [0x00194] in <43555eec0dc34d2abb4f01227fa5a2e9
>:0
info: Microsoft.AspNetCore.Server.Kestrel[14]
      Connection id "0HL2PMPE1RGS9" communication error.
Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -14 EFAULT bad address in system call argument
info: Microsoft.AspNetCore.Server.Kestrel[20]
      Connection id "0HL2PMPE1RGS9" request processing ended abnormally.
System.IO.IOException: Error -14 EFAULT bad address in system call argument ---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -14
EFAULT bad address in system call argument
   --- End of inner exception stack trace ---
  at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.SocketInput.CheckConnectionError () [0x00020] in <43555eec0dc34d2abb4f01227fa5a2e9>:0
  at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.SocketInput.GetResult () [0x00013] in <43555eec0dc34d2abb4f01227fa5a2e9>:0
  at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1+<RequestProcessingAsync>d__2[TContext].MoveNext () [0x00194] in <43555eec0dc34d2abb4f01227fa5a2e9
>:0

有没有人设法在Mono上运行AspNetCore v 1.1?任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:0)

我的临时解决方案:

  1. 将Microsoft.AspNetCore.Server.Kestrel降级为1.0.3
  2. 从输出中删除System.Runtime.InteropServices.RuntimeInformation.dll(因为dotnet / corefx#9012)
  3. 将Microsoft.Extensions.Logging.Console降级为1.0.2(因为1.1.1拒绝使用单声道的System.Runtime.InteropServices.RuntimeInformation.dll,但是1.0.2 - 不要)
  4. 有效!