当我在本地主机中测试我的代码时,它在urlbase http://localhost:port/上运行。但是在aks中设置前缀http://localhost:port/prefix/
如何在不同的环境中设置动态前缀?
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "prefix/{controller=Home}/{action=Index}/{id?}");
});
}
在此配置中,AKS设置网址:http://localhost:port/prefix/prefix/