如何在网址库中定义动态前缀

时间:2019-04-30 10:59:17

标签: docker asp.net-core-mvc azure-aks

当我在本地主机中测试我的代码时,它在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/

0 个答案:

没有答案