简体   繁体   English

在IIS中创建Web站点和Web应用程序

[英]Creating Web-Site and Web Application in IIS

Till date, I was thinking that we always create/host web-site in IIS. 到目前为止,我在想我们总是在IIS中创建/托管网站 But I was going through powershell tutorial today which says it is different to create web-site and a web application. 但我今天正在阅读powershell教程,其中说创建网站和Web应用程序是不同的。

This is the tutorial link (check different section on creating web site and application) - 这是教程链接(查看创建网站和应用程序的不同部分) -
http://learn.iis.net/page.aspx/433/powershell-snap-in-creating-web-sites-web-applications-virtual-directories-and-application-pools/ http://learn.iis.net/page.aspx/433/powershell-snap-in-creating-web-sites-web-applications-virtual-directories-and-application-pools/

Can please guide what is the difference between the two. 请指导一下这两者有什么区别。
Any example will be really helpful. 任何例子都会非常有用。

Thank you! 谢谢!

A web site in IIS is the top level under Sites. IIS中的网站是网站下的顶级网站。 The default one that is normally automatically created for you when installing IIS is named "Default Web Site". 通常在安装IIS时自动为您创建的默认名称为“默认网站”。
This is the "root" that runs on port 80. 这是在端口80上运行的“根”。
Under that, you can create virtual directories , which is basically sub-levels under the root web site, or you can create separate web applications that lives as separate applications under the root level. 在此之下,您可以创建虚拟目录 ,这些目录基本上是根网站下的子级别,或者您可以创建单独的Web应用程序 ,这些应用程序在根级别下作为单独的应用程序存在。
A web application must live under a web site . Web应用程序必须位于Web站点下

It is possible to create other web sites that can either be set up to run on other ports (ie 81), or to be named with a different host name which enables multiple sites to run on same port number. 可以创建其他网站 ,这些网站可以设置为在其他端口(即81)上运行,也可以使用不同的主机名命名,这使得多个站点可以在相同的端口号上运行。 If named with a different host name, this name must be registered in a DNS server somewere to point to the IP address for your server. 如果使用不同的主机名命名,则必须在DNS服务器中注册此名称,而这些名称必须指向服务器的IP地址。 A workaround is also to to add it as an entry in the hosts file on the client computer that should access it. 解决方法也是将其添加为应访问它的客户端计算机上的hosts文件中的条目。

This is example on how it looks in IIS Manager : 这是它在IIS管理器中的外观示例

IIS中的网站和Web应用程序示例
网站详情

I have a script I use when creating a website and AppPool in IIS 7+, .net4, Integrated pipeline and thought you might find it useful. 我有一个脚本,我在IIS 7 +,。net4,集成管道中创建网站和AppPool时使用,并认为您可能会觉得它很有用。

Use it as so: 使用它如下:

CreateSite.ps1 [WebsiteName] [AppPoolName] [Port] [Path]

If you are reinstalling the site, you will need to Stop it first. 如果要重新安装站点,则需要先停止它。 That is done as so: 这样做是这样的:

StopSite.ps1 [WebsiteName] [AppPoolName]

you can grab the scripts from my gist 你可以从我的要点中获取脚本

Update I have added/extended the scripts and put them in their own Github repository 更新我添加/扩展了脚本并将它们放在自己的Github存储库中

这是我的CreateWebsite PowerShell脚本: httpCreateWebsite

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM