簡體   English   中英

運行Docker映像導致Kestrel異常

[英]Running Docker image cause an Kestrel Exception

當我嘗試在Linux OS中運行Docker映像時遇到奇怪的行為-該映像包含.Net核心Web API項目

這是我的Program.cs

 var host = new WebHostBuilder()
.UseKestrel().UseStartup<Startup>().Build();
 host.Run();

我的Docker-compose.yml文件

version: '2'
services:
server:
    image: repo.testCompany.com:1443/testCompany:6
    ports:
    - "60000:60000"
    hostname: ucp.${HOST_HOSTNAME}
    restart: unless-stopped

映像已成功構建並推送。問題是當Web API嘗試在容器中運行項目並引發運行時異常時-

Unhandled Exception: System.AggregateException: One or more errors occurred. 
(Error -99 EADDRNOTAVAIL address not available) ---> 
Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error 
-99 EADDRNOTAVAIL address not available
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.Check(Int32 
statusCode)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.tcp_bind(UvTcpHandle handle, SockAddr& addr, Int32 flags)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvTcpHandle.Bind(ServerAddress address)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.TcpListener.CreateListenSocket()
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Listener.<>c.<StartAsync>b__6_0(Object state)
 --- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
 at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelEngine.CreateServer(ServerAddress address)
   at Microsoft.AspNetCore.Server.Kestrel.KestrelServer.Start[TContext](IHttpApplication`1 application)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.Start()
at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host, CancellationToken token, String shutdownMessage)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
at Exactor.XeroConnector.API.Program.Main(String[] args)

主要問題是錯誤不是在本地計算機上重現,而是僅在通過Jenkins構建和上傳映像時重現。 能否請您提供一些建議。

Tnx的答案問題是詹金斯不知何故不發布最新圖片。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM