简体   繁体   English

如何在IIS默认网站根目录(虚拟路径:“ /”)中创建应用程序?

[英]How to create Application in the IIS Default Web Site root (virtual path : '/')?

Context 上下文

I have an Asp.Net MVC application. 我有一个Asp.Net MVC应用程序。 I would like to deploy it to an IIS (Windows Server 2016). 我想将其部署到IIS(Windows Server 2016)。 I do not care which will be physical path, but I would like to access to the application in the virtual path '/' 我不在乎哪个将是物理路径,但是我想在虚拟路径“ /”中访问应用程序

(I am using Package web publish method, because no online access to the server, but I think this question is on IIS/ASP and not about publishing. I clearly miss some basic concept about IIS/ASP.) (我使用的是Package Web publish方法,因为没有在线访问服务器,但是我认为这个问题在IIS / ASP上,而不是在发布上。我显然错过了关于IIS / ASP的一些基本概念。

What I've tried 我尝试过的

1) When I try to create an Application in IIS then the dialog forces me to add an application Alias, which becomes the part of the virtual path. 1)当我尝试在IIS中创建应用程序时,对话框将强制我添加一个应用程序别名,该别名将成为虚拟路径的一部分。 So regardless the physical path now the the url will be 因此,无论现在的物理路径如何,URL都是

myserver/myapp/mypage instead of myserver/mypage myserver / myapp / mypage而不是myserver / mypage

which is not what I want. 这不是我想要的。 I would like to access to the page as myserver/mypage 我想以myserver / mypage的身份访问该页面

2) If I simply deploy the app under wwwroot then it will appear as myserver/mypage it seems to be working, but where is the "Application" this case? 2)如果我只是将应用程序部署在wwwroot下,那么它将以myserver / mypage的形式显示,似乎可以正常工作,但是这种情况下的“应用程序”在哪里? (see picture). (见图)。

Question

Maybe I missing something: Is this the Default Web Site is an "Application" in its own right? 也许我错过了一些东西:这是默认网站本身就是一个“应用程序”吗? How to configure then its Application settings? 然后如何配置其应用程序设置? If not, then how can I create an Application which's virtual path is '/'? 如果不是,那么我如何创建虚拟路径为“ /”的应用程序?

在此处输入图片说明

If I have understood your question correctly, you want to access the application as servername/pagename. 如果我正确理解了您的问题,则希望以服务器名/页面名的身份访问该应用程序。 In order to do so, do not create an "application" or "virtual directory" under a "website". 为此,请勿在“网站”下创建“应用程序”或“虚拟目录”。 Instead, directly host the content under Default website. 而是直接将内容托管在默认网站下。 You can change its path under "Basic Settings" and point it to your content folder. 您可以在“基本设置”下更改其路径,并将其指向您的内容文件夹。

You can also create another website at port 80 and point it to the location where your content is present. 您还可以在端口80上创建另一个网站,并将其指向您的内容所在的位置。 However, you will not be allowed to create 2 website with the same IP-port-hostname combination. 但是,将不允许您使用相同的IP端口-主机名组合创建2个网站。 You can solve this problem further in 3 ways. 您可以通过3种方式进一步解决此问题。

  1. If Default web site is not in use, then instead of creating another website, click on Default website, select basic setting from right hand panel and change the path to application content folder. 如果未使用默认网站,则不要创建其他网站,而是单击默认网站,从右侧面板中选择基本设置,然后将路径更改为应用程序内容文件夹。

  2. If Default website is in use, then create another another website at port 80 with a hostname. 如果使用的是“默认网站”,则在端口80处使用主机名创建另一个网站。

  3. If you do not have a hostname and are accessing the application using server-name, then you will have to modify the port to 8080 or something like that. 如果您没有主机名,而是使用服务器名访问应用程序,则必须将端口修改为8080或类似的名称。

Refer my blog - https://blogs.msdn.microsoft.com/parvez/2016/07/27/iis-bindings/ for more information about IIS bindings 请参阅我的博客-https: //blogs.msdn.microsoft.com/parvez/2016/07/27/iis-bindings/了解有关IIS绑定的更多信息

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

相关问题 如何在iis 7服务器中创建默认网站? - How to create default web site in iis 7 server? 如何将应用程序添加到IIS 7中的默认网站? - How do I add an application to Default Web Site in IIS 7? 虚拟目录根与默认网站根 - Virtual Directory root vs Default web site root 如何防止IIS默认站点web.config文件被虚拟目录继承? - How do you prevent the IIS default site web.config file being inherited by virtual directories? 在IIS默认网站下创建asp.net MVC Web应用程序或将其创建为新网站之间的区别 - Difference between creating my asp.net MVC web application ,under the IIS Default web site, or create it as a new web site 如何在IIS7中获取虚拟应用程序或Virtual Dir的根目录? - How to get root directory of Virtual Application or Virtual Dir in IIS7? IIS根路径与虚拟目录的路径 - IIS Root Path vs Path of virtual directory 网站作为IIS 7中的应用程序 - web site as application in IIS 7 TFS 2017版本定义。 WinRM - IIS Web App管理任务。 在“默认网站”下创建应用程序 - TFS 2017 Release definition. WinRM - IIS Web App Management task. Create application under “Default web site” 将IIS7.5网站作为应用程序时-应用程序“默认网站”中的服务器错误? - when Make IIS7.5 Web Site an Application - Server Error in Application “DEFAULT WEB SITE”?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM