iis - 部署到 IIS 后,Blazor 服务器组件无法路由到基本 URL
问题描述
我们已将 Blazor 服务器应用程序部署到 IIS,当我们浏览时,登录后使用 http://someIp/WebTool URL 获取登录页面,下一个组件将重定向到 http://someIp/Dashboard 但我们需要类似 http:// someIp/WebTool/Dashboard.The Webtool 在我们尝试更改 _Host.cshtml 的 IP 后丢失,但是没有用,任何人都可以让我们知道我们哪里出错了。我们也尝试过 app.UsePathBase("/Webtool"); 在 Startup.cs 中。任何建议都会有所帮助,在此先感谢
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UsePathBase("/UpgradeWeb");
app.UseStaticFiles();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/_Host");
});
}
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddScoped<AuthenticationStateProvider, CustomAuthenticationStateProvider>();
services.Configure<ToolConfig>(Configuration.GetSection("ToolConfig"));
services.AddScoped<IUserService, UserService>();
services.AddSingleton<HttpClient>();
var appSettingSection = Configuration.GetSection("AppSettings");
services.Configure<ApiKeyDetails>(Configuration.GetSection("ApiKeyDetails"));
services.Configure<WebAppSettings>(appSettingSection);
services.AddScoped<InvokeApiHandler>();
services.AddScoped<SessionService>();
services.AddScoped<DashboardService>();
services.AddScoped<UpgradeRequestService>();
services.AddScoped<Information>();
services.AddScoped<ReportsService>();
services.AddScoped<MasterConfigurationService>();
services.AddScoped<UserMappingService>();
services.AddScoped<RolesService>();
services.AddScoped<AllReportsService>();
services.AddScoped<JiraService>();
services.AddScoped<NotificationService>();
services.AddBlazoredSessionStorage();
}
解决方案
推荐阅读
- antlr4 - 带有条件缺失分隔符的 Antlr4 表达式
- sas - 如何转置一列中有多个项目响应的数据?在 SAS
- java - Java中用于屏幕颜色分析的类
- laravel - 如何使用 laravel-6 从标题创建 slug URL?
- c# - 在 Unity 中隐藏其他场景中的游戏对象
- python - 切换默认浏览器后 Jupyter Notebook 500 内部服务器错误
- reactjs - React Typescript 如何设置状态
- python-3.x - 在 Python 中读取分号 (';') 分隔的原始文本
- python - 如何使用 javascript 在 Django 中执行 Python 脚本
- javascript - 将多个参数从 Jquery 传递到 ASPX Web 方法不起作用