[英]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
. 我现在要解决的问题是我现在在复制方面遇到了一些问题,因为我在
localhost
和localhost/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.