在Kubernetes中启动Kestrel的ASP.NET Core 2.0错误
创build了一个新的ASP.NET Core 2.0项目,它在本地运行良好。 然后在本地运行在Docker容器中后,它也可以正常工作。 但是当我尝试在Kubernetes窗格中使用Docker镜像时,它会运行几分钟,然后给我这个:
Unhandled Exception: System.InvalidOperationException: A path base can only be configured using IApplicationBuilder.UsePathBase(). at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder. <BindAddressAsync>d__7.MoveNext()
这是我的Program.cs
:
public class Program { public static void Main(string[] args) { BuildWebHost(args).Run(); } public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() .Build(); }
Startup.cs
:
public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions { HotModuleReplacement = true, ReactHotModuleReplacement = true }); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); routes.MapSpaFallbackRoute( name: "spa-fallback", defaults: new { controller = "Home", action = "Index" }); }); } }
- Docker ASP.net 5 beta4 kestrel不保持容器运行
- 如何从泊坞窗图像中排除应用程序设置(并将其添加到容器中)?
- configuration中缺less从VS发布到Ubuntu的Docker?
- 在Docker容器中的IIS中部署ASPNET核心应用程序
- 在使用GMSA的docker中运行AspNet Core应用程序
- 将.net核心应用程序部署到docker会给“Microsoft.DotNet.Props”找不到错误
- 如何从ASP.NET核心项目中删除docker支持?
- ASP.NET Core HttpClient不能在容器中进行HTTPS调用
- 未能build立:获取https://registry-1.docker.io/v2/microsoft/aspnetcore/manifests/1.1:未经授权:不正确的用户名或密码