IIS发布网页的基本操作
生活随笔
收集整理的這篇文章主要介紹了
IIS发布网页的基本操作
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
前提是IIS已經(jīng)安裝;
在運(yùn)行框輸入下圖字符串,回車;進(jìn)入到IIS管理器;
在D盤inetpub目錄下新建一個(gè)demo1文件夾,把要發(fā)布的兩個(gè)文件放入;
在IIS管理器右擊 網(wǎng)站 節(jié)點(diǎn),添加網(wǎng)站...;
自己起一個(gè)網(wǎng)站名稱;物理路徑選擇前面的目錄;C或D盤的inetpub目錄是IIS默認(rèn)的發(fā)布目錄;
端口找一個(gè)沒有使用的;其他默認(rèn);確定;
之后新建的網(wǎng)站就出來了;
在IIS管理器右側(cè),操作列表,選擇 瀏覽網(wǎng)站,瀏覽 *:8019;
瀏覽器打開localhost:8019,在其后輸入/demo1.aspx,就看到了頁面的效果;
這是一個(gè)基本的網(wǎng)頁查詢顯示數(shù)據(jù)庫程序;
demo1.aspx;
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="demo1.aspx.cs" Inherits="demo1" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title></title> </head> <body><form id="form1" runat="server"><div><asp:GridView ID="GridView1" runat="server"></asp:GridView></div></form> </body> </html>demo1.aspx.cs;
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient;public partial class demo1 : System.Web.UI.Page {protected void Page_Load(object sender, EventArgs e){//IsPostBack只有在第一次打開的時(shí)候是false,其它時(shí)候都是trueif (!IsPostBack){databind();}}void databind(){SqlConnection conn = new SqlConnection("Data Source=localhost;Initial Catalog=hatcher;User Id=sa;Password=kxxxxxb;");SqlCommand MyCommand = new SqlCommand("SELECT * FROM advpeoples", conn);SqlDataAdapter SelectAdapter = new SqlDataAdapter();SelectAdapter.SelectCommand = MyCommand;DataSet MyDataSet = new DataSet();conn.Open();SelectAdapter.SelectCommand.ExecuteNonQuery();SelectAdapter.Fill(MyDataSet);GridView1.DataSource = MyDataSet.Tables[0];GridView1.DataBind();conn.Close();} }總結(jié)
以上是生活随笔為你收集整理的IIS发布网页的基本操作的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Bing Maps Geographic
- 下一篇: 多核 CPU 和多个 CPU 有何区别