简体   繁体   English

IIS和ASP.NET:虚拟目录/应用程序

[英]IIS and ASP.NET: Virtual directory / application

I am setting up an ASP.NET MVC application to run on IIS. 我正在设置一个ASP.NET MVC应用程序以在IIS上运行。 I want the application to run when I type in localhost/mywebsite to a browser on the local machine. 当我在本地计算机上的浏览器中键入localhost/mywebsite时,我希望该应用程序运行。

If I just add a new web site to IIS, with the physical location set to the directory of my published AST.NET application, the default is that localhost shows me the homepage of the application. 如果我只是将一个新的网站添加到IIS,并将物理位置设置为我发布的AST.NET应用程序的目录,则默认值为localhost显示给我该应用程序的主页。

In IIS, if I click on Add Application , then this allows me to specify an alias and a physical location for this alias. 在IIS中,如果我单击Add Application ,则这允许我指定别名和该别名的物理位置。 If I set this alias to mywebsite , and the physical location to the same directory as before, then this theoretically should work, right? 如果我将此别名设置为mywebsite ,并且将物理位置设置为与以前相同的目录,那么理论上应该可行,对吗?

The issue I now want to address is that I now have some problems with duplication, because I am running the application both at localhost and at localhost/mywebsite . 我现在要解决的问题是我现在在复制方面遇到了一些问题,因为我在localhostlocalhost/mywebsite都运行应用程序。 How do I remove the application from the former, without removing the entire web site? 如何从前者中删除该应用程序,而不删除整个网站?

Thanks! 谢谢!

Create an empty folder and in IIS set up a default website with this folder for the localhost url. 创建一个空文件夹,并在IIS中为此localhost URL设置一个默认网站。 It can be empty website. 它可以是空网站。 Inside this folder, create another folder "mywebsite" for your website and copy your ASP.NET MVC files into it. 在此文件夹中,为您的网站创建另一个文件夹“ mywebsite”,并将您的ASP.NET MVC文件复制到其中。 In IIS, collapse your default website and locate the "mywebsite" folder. 在IIS中,折叠默认网站并找到“ mywebsite”文件夹。 Right click to folder and select "Convert To Application" button. 右键单击文件夹,然后选择“转换为应用程序”按钮。 That's it. 而已。

Just go to your Internet Information Service Manager >> then Sites >> Default Websites >> Select your mywebsite , open right menu and select remove . 只需转到Internet信息服务管理器>>,然后依次单击“ mywebsite ,“默认网站”,然后选择“ mywebsite ,打开右键菜单,然后选择“ 删除”

Is that what you wanted? 那是你想要的吗?

If you want to remove application at localhost just remove all those files from the directory manually except mywebsite folder and if you still want to visit localhost and dont want to see error just put a simple index.html file in the parent directory. 如果要删除localhost应用程序,只需手动删除目录中所有文件( mywebsite文件夹除外),如果您仍要访问localhost并不想看到错误,只需在父目录中放置一个简单的index.html文件即可。

So, you folder structure would be: 因此,您的文件夹结构将是:

main - mapped to localhost - holds just an index.html
  | 
  |_  mywebsite  - mapped to localhost/mywebsite - holds all the file

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在IIS / ASP.NET上的物理文件夹中创建虚拟应用程序/目录 - Creating virtual application/directory in physical folder on IIS/ASP.NET 没有创建asp.net应用程序扩展名的IIS 6虚拟目录 - IIS 6 Virtual Directory created without the asp.net application extensions 避免将虚拟目录添加到ASP.NET 5应用程序上的路径 - Avoid adding virtual directory to path on an ASP.NET 5 application 在单个虚拟目录中部署多个ASP.NET MVC应用程序 - Deploying multiple ASP.NET MVC application in a single Virtual directory 保护ASP.NET Core Web API背后的虚拟目录(IIS) - Protect virtual directory (IIS) behind ASP.NET Core web API 使用IIS7通过c#/ asp.net网页访问虚拟目录(映射驱动器) - Accessing virtual directory(mapped drive) via c#/asp.net webpage with IIS7 如何访问Asp.net中的虚拟目录? - How to access virtual directory in Asp.net? 虚拟目录中的ASP.NET MVC - ASP.NET MVC in a virtual directory 本地IIS上的ASP.NET应用程序用于验证用户使用的活动目录 - ASP.NET application on local IIS express to authenticate users ussing active directory IIS 7.5 只显示目录列表或 403 而不是 ASP.NET 应用程序 - IIS 7.5 only shows directory list or 403 instead of ASP.NET Application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM