I have Startup.cs
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
var options = new RewriteOptions().AddRedirectToHttps(301, 44339);
app.UseRewriter(options);
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
var localizedOptions = app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>();
app.UseRequestLocalization(localizedOptions.Value);
app.UseIdentity();
app.UseMvc(routes =>
{
routes.MapRoute(
"LocalizedDefault",
"{lang:lang}/{controller=Home}/{action=Index}/{id?}"
);
routes.MapRoute(
"default",
"{*catchall}",
new { controller = "Home", action = "RedirectToDefaultLanguage", lang = "vi" });
});
}
and
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel().UseUrls("https://*:443")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseApplicationInsights()
.Build();
host.Run();
}
I used this cmd:
docker run -it --rm -p 1234:80 --name voiconshop_ps voiconshop
Here is ps:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f752d350823b voiconshop "dotnet VoiConShop.d…" About a minute ago Up 59 seconds 0.0.0.0:1234->80/tcp voiconshop_ps
And this is dockerfile
FROM microsoft/aspnetcore:1.1
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "VoiConShop.dll"]
I run http://localhost:1234/ then direct to https://localhost:44339/. However, the page return "This site can’t be reached". So what did I do wrongly? Please help me. Thanks you so much. If need more information I will edit this question.