简体   繁体   English

在IIS中部署网站

[英]Deploy Website in IIS

I am trying to deploy a website on IIS. 我正在尝试在IIS上部署网站。 When I deploy it without giving it a host name, everything works fine. 当我部署它而不给它一个主机名时,一切正常。

However, if I try to specify a host name, the website never loads in the browser. 但是,如果我尝试指定主机名,则该网站永远不会加载到浏览器中。 For instance, I gave it a hostname of www.webservice.com. 例如,我为其指定了主机名www.webservice.com。 When I try to load the home page, the web browser tries to access www.webservice.com:2000/HomePage.aspx but the connection always times out. 当我尝试加载主页时,Web浏览器尝试访问www.webservice.com:2000/HomePage.aspx,但是连接总是超时。

How can I solve this problem? 我怎么解决这个问题?

在此处输入图片说明

Seems like you want to host your website in your local IIS server. 似乎您想将网站托管在本地IIS服务器中。 Generally by default you can access your site by accessing localhost ie http://localhost:[port no]/HomePage.aspx 通常,默认情况下,您可以通过访问localhost来访问站点,即http:// localhost:[端口号] /HomePage.aspx

But if you want to give your own Host name, Either you can set up your domain or for local testing then try the following link: 但是,如果要提供自己的主机名,则可以设置域或进行本地测试,然后尝试以下链接:

use myfakesite.com instead of localhost in IIS 7 在IIS 7中使用myfakesite.com而不是localhost

Shihan's comments made me realise what you're trying to achieve: Shihan的评论使我意识到您要实现的目标:

You cannot do this since you do not own the domain name. 您不拥有域名,因此无法执行此操作。 If you owned the domain name then this would be fine. 如果您拥有域名,那么就可以了。

You need to register the domain name and point (via the DNS section) the A record to your server IP. 您需要注册域名并将A记录(通过DNS部分)指向您的服务器IP。 IIS is about taking in the request, dealing with it and spitting out what is relevant (based upon the request), it doesn't organise your DNS records for you (nor create them). IIS是关于接收请求,处理请求并吐出相关内容(基于请求)的,它不会为您组织DNS记录(也不会创建它们)。

However, since you're using a PC for this, I would suspect you're not on a static IP address which makes this much more complex. 但是,由于您使用的是PC,因此我怀疑您使用的不是静态IP地址,这会使情况变得更加复杂。

You will also need to note that IIS on a local PC is much more limited than on a Windows Server. 您还需要注意,本地PC上的IIS比Windows Server上的IIS受限制得多。

You have to either set up DNS to point to the host where IIS is running or make an entry in your "hosts" file. 您必须设置DNS使其指向运行IIS的主机,或者在“主机”文件中进行输入。 DNS is good for production purposes but if you just want to test something a hosts entry will be good enough. DNS可以用于生产目的,但是如果您只想测试某项主机条目就足够了。 You find the hosts file under %WINDOWSROOT%\\System32\\drivers\\etc (eg.: C:\\Windows\\System32\\drivers\\etc). 您可以在%WINDOWSROOT%\\ System32 \\ drivers \\ etc下找到主机文件(例如:C:\\ Windows \\ System32 \\ drivers \\ etc)。 Just add the name of site (www.webservice.com) there together with the IP of the IIS host. 只需在其中添加站点名称(www.webservice.com)以及IIS主机的IP。

IIS doesn't set up the DNS for you automatically. IIS不会自动为您设置DNS。

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

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