例如,假设我在一个解决方案中有两个项目
OrchardCore.WebUI(一个 asp.net 核心 MVC 主机,它引用了 OrchardCore.Module1)
OrchardCore.Module1(果园核心模块)
我想向https://localhost:44346/发出请求,以提供来自 OrchardCore.Module1 > Home > Index 的视图
这是我在OrchardCore.WebUI项目中的启动
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.AddOrchardCore().AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment 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.UseRouting();
app.UseOrchardCore();
}
}
}
我现在不需要 CMS 或任何东西,只是想提供一些默认视图。任何帮助是极大的赞赏。
OrchardCore.WebUI项目有包参考
<ItemGroup>
<PackageReference Include="OrchardCore.Application.Mvc.Targets" Version="1.0.0-rc1-10004" />
OrchardCore.Module1项目有包参考
<ItemGroup>
<PackageReference Include="OrchardCore.Module.Targets" Version="1.0.0-rc1-10004" />
我是否误解了索引视图的设置方式? 从根本上说,我试图让索引页面基于租户。另外,我需要每个租户都基于 RequestUrlHost,而不是 RequestUrlPrefix
这里 https://orchardcore.readthedocs.io/en/dev/docs/guides/create-modular-application-mvc/ 它说
在 MyModule 的 Startup.cs 文件中,将此代码添加到 Configure() 方法中。
routes.MapAreaRoute(
name: "Home",
areaName: "MyModule",
template: "",
defaults: new { controller = "Home", action = "Index" }
);
这似乎表明我想要完成的事情是正确的。但是,我不能让它工作。
我错过了什么?