简体   繁体   中英

Asp.net MVC multiple web projects in solution

I have a solution having two MVC Web Projects.

In main project, AdminController is works as expected(When I hit Admin/Action it looks for view in main project and work accordingly).

In second project I have SiteController . When I hit Site/Action it looks for view in main project and as it is not available in main project and throw error.

I want to access second project controller through main project but don't know how to achieve this.

I do not want to use Area functionality in main project. SiteController should be in second project and should be accessible through main project.

You have multiple solutions for this:

  1. Include the controllers of project 2 in project 1. This is not the same as an area but you'll have to add a reference to project 2 in project 1. asp-net-mvc-6-discovers-controllers
  2. If 1 is not an option, then you can debug directly on your local IIS without ports BUT on different site names. This makes sense as the ARE different sites. If they aren't then they should be hosted on the same project (see 1st solution).
  • Go to project properties
  • Select Web
  • On the Servers section choose local iis
  • Set the project url

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM