Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker + netcore2.1 ,Dashboard 无法打开 #140

Closed
imcc opened this issue Jun 7, 2018 · 4 comments

Comments

@imcc
Copy link

commented Jun 7, 2018

Bug

  • Which version of CAP, OS and .NET Core?

    • 操作系统:CentOS 7.2
    • 部署方式:docker
    • CAP 版本: 2.2.2 和 2.2.4
    • .Net版本:netcore2.1 (2.1.300)
  • What happen?

打开 Dashboard 时报500错误,异常信息如下:

fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HLEC92UDC35E", Request id "0HLEC92UDC35E:00000001": An unhandled exception was thrown by the application.
System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(ReadOnlySpan`1 str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(ReadOnlySpan`1 s, NumberStyles style, NumberFormatInfo info)
   at DotNetCore.CAP.Infrastructure.Helper.GetIpNum(String ipAddress)
   at DotNetCore.CAP.Infrastructure.Helper.IsInnerIP(String ipAddress)
   at DotNetCore.CAP.Dashboard.LocalRequestsOnlyAuthorizationFilter.Authorize(DashboardContext context)
   at DotNetCore.CAP.DashboardMiddleware.<>c__DisplayClass5_0.<Invoke>b__0(IDashboardAuthorizationFilter filter)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at DotNetCore.CAP.DashboardMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

备注:目前发现只会在 netcore2.1+docker 出现。开发环境是 macOS+netcore2.1,没有出现过这个错误。 退回到 netcore2.0 则一切正常。

@imcc

This comment has been minimized.

Copy link
Author

commented Jun 7, 2018

即使在部署的机器上 wget 127.0.0.1:port/cap,依然是这个错误。说明 context.Request.RemoteIpAddress 不对。

我在源码里加入了打印 RemoteIpAddress,发现使用内网地址访问时,context.Request.RemoteIpAddress = ::ffff:192.168.0.42
本机用 127.0.0.1 访问时,context.Request.RemoteIpAddress = ::ffff:172.17.0.1

这种格式的IP地址在 DotNetCore.CAP.Infrastructure.Helper.GetIpNum方法里引起了异常,导致了这个错误。

@yang-xiaodong

This comment has been minimized.

Copy link
Member

commented Jun 7, 2018

.net core 2.1 针对RemoteIpAddress的获取做了一些改动,这应该是一个新bug,谢谢反馈。

@yang-xiaodong yang-xiaodong added the bug label Jun 7, 2018

yang-xiaodong added a commit that referenced this issue Jun 7, 2018

@yang-xiaodong yang-xiaodong added the fixed label Jun 7, 2018

@yang-xiaodong

This comment has been minimized.

Copy link
Member

commented Jun 7, 2018

Fixed in version 2.2.5-preview-45139132

@imcc

This comment has been minimized.

Copy link
Author

commented Jun 7, 2018

thanks

@imcc imcc closed this Jun 7, 2018

yang-xiaodong added a commit that referenced this issue Jul 19, 2018
Release 2.2.5 (#162)
* update version to 2.2.4

* Fixed Incorrect local IP address judgment of IPv6. (#140)

* Fixed DateTime localization format conversion error to sql.(#139)

* update version to 2.2.5

* remove unused constructor.

* Fixed DateTime localization format conversion error to sql.(#139)

* Improved logging

* support RabbitMQ cluster configuration.

* Fixed dashboard message page re-requeue and re-executed  operate bug. (#158)

* refactor code

* refactor log extensions.

* refactor retry task processor.

* Fixed  configuration options of FailedThresholdCallback could not be invoke when the value less then three.  (#161)

* update samples.

* Fixed SendAsync or ExecuteAsync recursion retries bug. (#160)

* Fixed SendAsync or ExecuteAsync recursion retries bug. (#160)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.