Reputation: 5850
For example, assume I have two projects within a solution
OrchardCore.WebUI ( an asp.net core MVC host, which references OrchardCore.Module1)
OrchardCore.Module1 ( an orchard core module)
I would like a request to https://localhost:44346/ to serve the view from OrchardCore.Module1 > Home > Index
Here is my startup within the OrchardCore.WebUI project
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();
}
}
}
I dont need the CMS or anything at this point, just looking to serve some default view. Any help is greatly appreciated.
The OrchardCore.WebUI project has package reference
<ItemGroup>
<PackageReference Include="OrchardCore.Application.Mvc.Targets" Version="1.0.0-rc1-10004" />
The OrchardCore.Module1 project has package reference
<ItemGroup>
<PackageReference Include="OrchardCore.Module.Targets" Version="1.0.0-rc1-10004" />
Am I misunderstanding how the index view is setup? Fundamentally, I am trying to have the index page be based on the tenant. Also, I need each tenant to be based on the RequestUrlHost, rather than RequestUrlPrefix
Here https://orchardcore.readthedocs.io/en/dev/docs/guides/create-modular-application-mvc/ it says
In the Startup.cs file of MyModule, add this code in the Configure() method.
routes.MapAreaRoute(
name: "Home",
areaName: "MyModule",
template: "",
defaults: new { controller = "Home", action = "Index" }
);
That seems to suggest that what I am trying to accomplish is right. However, I cant get this to work.
What am I missing?
Upvotes: 2
Views: 1474
Reputation: 3
In OrchardCore.Module1.csproj is the first line --
<Project Sdk="Microsoft.NET.Sdk.Razor">
and in the Property Group with the target framework add -
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
This should resolve the problem
Upvotes: 0