Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put ASP.NET MVC application in subdirectory of main MVC application?

I have my main website's application on my server at C:\inetpub\wwwroot, which I can view at http://www.mysite.com

I've created another separate MVC web application, named Subdir. I'd like to set it up so that if I visit http://www.mysite.com/Subdir, it will run my Subdir app.

What do I need to do for that? I obviously can't just drop the app in C:\inetpub\wwwroot\mysite.webui\whatever. Do I need to put the application in a certain directory? Do I need to configure anything in IIS?

like image 636
Steven Avatar asked Dec 21 '11 02:12

Steven


People also ask

Can we plug an ASP.NET MVC into an existing ASP.NET application?

Luckily, the answer is yes. Combining ASP.NET Webforms and ASP.NET MVC in one application is possible—in fact, it is quite easy. The reason for this is that the ASP.NET MVC framework has been built on top of ASP.NET.

What is App_Start folder MVC?

The App_Start folder of MVC application is used to contain the class files which are needed to be executed at the time the application starts. The classes like BundleConfig, FilterConfig, IdentityConfig, RouteConfig, and Startup. Auth etc. are stored within this folder.

Can MVC and ASP.NET coexist?

Yes. MVC is just a different implementation of the IHttpHandler interface so both classic ASP.NET and ASP.NET MVC pages can coexist in the same app.

What are the 3 main components of an ASP.NET MVC application?

The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications.


1 Answers

Yes you can drop the application in a subfolder of your original applicaiton, but the important thing is how you set up IIS for this new application. I suggest using sibling/parallel folders as a best practice.

  1. Deploy your applications in a sibling folder:

    c:\inetpub\wwwroot\ is your main app

    c:\inetpub\mynewapp\ for your secondary application.

  2. In IIS, expand your existing website and add a new Application, pointing the root folder to c:\inetpub\mynewapp\

Result:

http://mysite = c:\inetpub\wwwroot\

http://mysite/mynewapp/ = c:\inetpub\mynewapp

You're all good, and this is a pretty accepted "best practice" as you can tighten down NTFS and App Pool Identities easier now. Look up information on these topics and you'll be a step ahead of the game with your sites deployed this way.

like image 99
one.beat.consumer Avatar answered Oct 30 '22 19:10

one.beat.consumer