将ASP.NET MVC应用程序放在主MVC应用程序的子目录中? [英] Put ASP.NET MVC application in subdirectory of main MVC application?

查看:84
本文介绍了将ASP.NET MVC应用程序放在主MVC应用程序的子目录中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的主网站应用程序在我的服务器上 C:\inetpub \ _www ,我可以在 http://查看www.mysite.com

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

我创建了另一个单独的MVC Web应用程序,名为 Subdir 。我想设置它,这样如果我访问 http://www.mysite.com/Subdir ,它将运行我的 Subdir app。

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.

我需要做些什么?我显然不能只将应用程序放在 C:\inetpub \wwwroot \ themys.webui \whatever 中。我是否需要将应用程序放在某个目录中?我是否需要在IIS中配置任何内容?

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?

推荐答案

是的,您可以将应用程序放在原始应用程序的子文件夹中,但是重要的是如何为这个新应用程序设置IIS。我建议使用兄弟/并行文件夹作为最佳实践。

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. 在兄弟文件夹中部署应用程序:

  1. Deploy your applications in a sibling folder:

c:\inetpub \wwwroot \ 是您的主要应用

c:\inetpub \ mynewapp \ 用于您的辅助应用程序。

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

在IIS中,展开现有网站并添加新应用程序,将根文件夹指向 c:\inetpub \ mynewapp \

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

结果:

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

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

你们都很好,这是一个非常被接受的最佳实践,因为你现在可以更轻松地收紧NTFS和App Pool Identities。查看有关这些主题的信息,您将以这种方式部署您的网站,从而领先于游戏。

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.

这篇关于将ASP.NET MVC应用程序放在主MVC应用程序的子目录中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆