如何为本地主机网站配置IIS 7? [英] How to configure IIS 7 for localhost website?

查看:120
本文介绍了如何为本地主机网站配置IIS 7?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Asp.Net的新手

I am new in Asp.Net

我已经在Windows系统上启用了IIS 7的功能,并且能够看到IIS管理器.

I have enabled features of IIS 7 on my windows system and able to see IIS manager.

我创建了一个应用程序,但是通过Visual Studio构建/运行该应用程序,然后转到浏览器并使用不同的端口号运行该应用程序.当我通过Visual Studio停止构建/运行应用程序时,再次刷新浏览器应用程序无法运行.

I created an application but build/run application through visual studio it goes to browser and run the application with different port number. When i stop build/run application through visual studio and again i refresh browser application could not run.

我想在没有Visual Studio的情况下运行应用程序.怎么做.

I want to run application without visual studio. How to do this.

它给出了这个:http://localhost:9864/

推荐答案

要使用新网站配置IIS,请遵循以下指示:

To configure IIS with a new website follow these instructions:

  1. 打开IIS管理器,右键单击网站"(在右侧菜单中),然后单击添加网站"

  1. 为站点提供站点名称,计算机上的物理路径和主机名

  1. Give the site a Site Name, The physical path on your machine, and a Host Name

对于选择哪种网站物理路径,您可以阅读以下约定:

There are some conventions as for what website physical path to choose you can read about it in this SO question

  1. 在Windows资源管理器中,转到C:\Windows\System32\drivers\etc并编辑hosts文件

在文件末尾添加以下行:

Add this line at the end of the file:

127.0.0.1您从iis-ie-localhost.testsite.com选择的主机名

127.0.0.1 your-chosen-host-name-from-iis-ie-localhost.testsite.com

并保存文件

就是这样.您可以打开浏览器并浏览为网站选择的主机名,或在IIS中右键单击您的站点,然后单击管理网站-浏览"

Thats about it. You can open your browser and browse the Host Name you chosen for your website or in IIS right click your site and click Manage Website - Browse

重要提示

如果您希望使用与VS使用的地址相同的地址(http://localhost:9864/),则在第2步中将主机名"文本框保留为空白,而将端口"文本框更改为所需的端口(9864).在这种情况下,您也可以忽略步骤3.

If you wish to use the same address as your VS uses (http://localhost:9864/) then on step 2 leave the Host Name textbox blank and instead change the Port textbox to your desired port (9864). In this case you can also ignore step 3.

作为网站注释:

如果在VS安装之后在计算机上安装了IIS,则可能会发生一些冲突.在此阶段,您也许可以浏览为html的静态内容,但不能浏览诸如.aspx文件的.NET资源.如果通过浏览到.NET文件,您收到一条消息,指出由于扩展名配置而无法提供您所请求的页面,则可以使用

If you installed IIS on your machine after the VS installation you might get some conflicts. You might be able by this stage to browse to static content as html but not .NET resources like aspx files. If by browsing to .NET files you get a message saying The page you are requesting cannot be served because of the extension configuration you can solve it with this SO question

这篇关于如何为本地主机网站配置IIS 7?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆