web 服务器怎么启动

web 服务器怎么启动,第1张

如果允许在站点中上载或下载文件,就需要在 Web 服务器上设置 FTP。无论站点是位于 Intranet 还是位于 Internet 上,使用 FTP 在所提供的位置中上载和下载文件的原理是相同的。您需要将文件放在 FTP 服务器上的目录中,以便用户可以建立 FTP 连接并通过 FTP 客户端或启用 FTP 的 Web 浏览器进行文件传输。本文介绍在 Web 服务器上如何启用并运行 FTP 服务。
安装 IIS 70 中的 FTP。
若要设置 FTP 站点,必须先通过Windows Server 2008 中的角色管理工具来安装 FTP 服务。具体过程如下:
在 Windows 客户端上安装 FTP 服务。
1 在"开始"菜单上单击"控制面板"。
2 单击"程序",然后单击"打开或关闭 Windows 功能"。
3 在"Windows 功能"对话框中,展开"Internet 信息服务"节点。
4 展开"FTP 发布服务"节点,然后单击"FTP 发布服务"复选框。
5 单击"FTP 管理控制台"复选框和"FTP 服务器"复选框,然后单击"确定"。
在 Windows 服务器上安装 FTP 服务
1 在"开始"菜单上,单击"管理工具",然后单击"服务器管理器"。
2 在"服务器管理器"窗格的"角色摘要"部分中,单击"Web 服务器(IIS)"。
3 在"Web 服务器(IIS)"部分中,单击"添加角色服务"。
4 在"角色服务"下,选择"FTP 发布服务"。这将安装 FTP 服务和 FTP 管理控制台。
5 单击"下一步",然后单击"安装"。
在 IIS 70 中启动 FTP 服务
就像 IIS 70 上默认不安装 FTP 服务一样,当您在 IIS 70 上安装 FTP 服务后,默认情况下也不会启动该服务。因此,在安装 FTP 服务后必须启动该服务。如果 FTP 服务之前已停止或暂停,可能也需要启动该服务。
在 Windows 客户端上启动 FTP 服务
1 在"开始"菜单上单击"控制面板"。
2 在"控制面板"中,单击"系统和维护",然后单击"管理工具"。
3 双击"服务",右键单击"FTP 发布服务",然后从菜单中选择"启动"。
在 Windows 服务器上启动 FTP 服务
1 在"开始"菜单上,单击"管理工具",然后单击"服务器管理器"。
2 在"服务器管理器"窗格的"角色摘要"部分中,单击"Web 服务器(IIS)"。
3 在"Web 服务器(IIS)"部分的"系统服务"下,单击"FTP 发布服务",然后单击"启动"。

第一步:IIS的安装 A在控制面板中选择“添加/删除程序”,在出现的对话框中选择“添加/删除Windows组件”。 B在出现的复选框中选择安装Internet信息服务(IIS),这一组件约需19MB的空间。 C点击“下一步”,并将Win2000安装光盘放入光驱,安装程序即可将程序文件复制到硬盘中,点击“结束”即可完成。 第二步:IIS中Web服务器的基本配置 IIS中Web服务器的基本配置主要包括如下几部分: A打开IIS服务器的配置窗口,选择“开始”→“程序”→“管理工具”→“Internet服务管理器”,或者“选择”→“控制面板”→“管理工具”→“Internet服务管理器”也可,打开的窗口。 B在打开的窗口中鼠标右击“默认Web站点”,选择“属性”菜单。 C在出现的“默认Web站点属性”窗口中,选择“主目录”标签,用以设置Web内容在硬盘中的位置,默认目录为“C:\Inetpub\>看了你的留言直接在这回吧,其实网页方面我也是个菜鸟。去年我做过一个类似的,当时也是自学了1个月的iis的配置,aspnet,vb串口 *** 作等,大二假期比较闲。
做法:用DS18B20温度传感器连接51单片机,然后单片机通过串口与电脑通信,电脑成为服务器,手机连接网页,进行温度监控,开关单片机外接的继电器等等 *** 作。
硬件端的代码对你没用,服务器端我的基本思路就是aspnet连接数据库,然后用vb实时扫描数据库,通过vb中的MScomm控件连接串口,vb的代码对你也没啥用,因为MScomm连接单片机的代码的“通信协议”我是写在单片机上的,不配套就没用了
这是网页的代码,不精简,高手莫笑
主要功能就是连接数据库。。。里面没能直接通过aspnet控制串口,貌似也有C#直接控制的,你去CSDN看看吧,我试过是没问题的,就是 *** 作不太方便(可能我太菜了)
using System;
using SystemConfiguration;
using SystemData;
using SystemLinq;
using SystemWeb;
using SystemWebSecurity;
using SystemWebUI;
using SystemWebUIHtmlControls;
using SystemWebUIWebControls;
using SystemWebUIWebControlsWebParts;
using SystemXmlLinq;
using SystemDataSqlClient;
public partial class _Default : SystemWebUIPage
{
protected void Page_Load(object sender, EventArgs e)
{
//温度
SqlConnection cnn1 = new SqlConnection(@"Data Source=YINGJHSHP541\SQLEXPRESS;Initial Catalog=test3;User ID=sa;Password=yingjh");
cnn1Open();
//表
SqlCommand cmd1 = new SqlCommand();
cmd1Connection = cnn1;
cmd1CommandText = "select from T";
SqlDataReader data1;
data1 = cmd1ExecuteReader();
GridView1DataSource = data1;
GridView1DataBind();
cnn1Close();
//图
cnn1Open();
SqlDataAdapter Da = new SqlDataAdapter();
DaSelectCommand = new SqlCommand("select 时间,[温度(℃)] from T", cnn1);
DataSet ds = new DataSet();
DaFill(ds);
DataView myView = new DataView(dsTables[0]);
Chart1Series["Series1"]PointsDataBindXY(myView, "时间", myView, "温度(℃)");
cnn1Close();
cnn1Dispose();
//状态
SqlConnection cnn2 = new SqlConnection();
cnn2ConnectionString = @"Data Source=YINGJHSHP541\SQLEXPRESS;Initial Catalog=test3;User ID=sa;Password=yingjh";
cnn2Open();
SqlCommand cmd2 = new SqlCommand();
cmd2Connection = cnn2;
cmd2CommandText = "select from ST";
SqlDataReader data2;
data2 = cmd2ExecuteReader();
data2Read();
string a = data2GetString(0);
switch (a)
{
case "1":
Label2Text = "打开";
break;
case "0":
Label2Text = "预设";
break;
case "-1":
Label2Text = "关闭";
break;
default:
break;
}
Label4Text = data2GetString(1) + "℃";
cnn2Close();
cnn2Dispose();
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection cnn = new SqlConnection(@"Data Source=YINGJHSHP541\SQLEXPRESS;Initial Catalog=test3;User ID=sa;Password=yingjh");
SqlCommand cmd = new SqlCommand();
cnnOpen();
cmdConnection = cnn;
//设置开关,flag为开关控制权
switch (DropDownList1Text)
{
case "1":
cmdCommandText = "update ST set STATE='1'" + ",flag='1'";
break;
case "0":
cmdCommandText = "update ST set STATE='0'" + ",STEMP='" + TextBox1Text + "',flag='1'";
break;
case "-1":
cmdCommandText = "update ST set STATE='-1'" + ",flag='1'";
break;
default:
cmdCommandText = "update ST set STATE='0'" + ",STEMP='" + TextBox1Text + "',flag='1'";
break;
}
cmdExecuteNonQuery();
cnnClose();
cnnDispose();
//温度
SqlConnection cnn1 = new SqlConnection(@"Data Source=YINGJHSHP541\SQLEXPRESS;Initial Catalog=test3;User ID=sa;Password=yingjh");
cnn1Open();
//表
SqlCommand cmd1 = new SqlCommand();
cmd1Connection = cnn1;
cmd1CommandText = "select from T";
SqlDataReader data1;
data1 = cmd1ExecuteReader();
GridView1DataSource = data1;
GridView1DataBind();
cnn1Close();
//图
cnn1Open();
SqlDataAdapter Da = new SqlDataAdapter();
DaSelectCommand = new SqlCommand("select 时间,[温度(℃)] from T", cnn1);
DataSet ds = new DataSet();
DaFill(ds);
DataView myView = new DataView(dsTables[0]);
Chart1Series["Series1"]PointsDataBindXY(myView, "时间", myView, "温度(℃)");
cnn1Close();
cnn1Dispose();
//状态
SqlConnection cnn2 = new SqlConnection();
cnn2ConnectionString = @"Data Source=YINGJHSHP541\SQLEXPRESS;Initial Catalog=test3;User ID=sa;Password=yingjh";
cnn2Open();
SqlCommand cmd2 = new SqlCommand();
cmd2Connection = cnn2;
cmd2CommandText = "select from ST";
SqlDataReader data2;
data2 = cmd2ExecuteReader();
data2Read();
string a = data2GetString(0);
switch (a)
{
case "1":
Label2Text = "打开";
break;
case "0":
Label2Text = "预设";
break;
case "-1":
Label2Text = "关闭";
break;
default:
break;
}
Label4Text = data2GetString(1) + "℃";
cnn2Close();
cnn2Dispose();
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}

win7搭建web服务器步骤:
1、首先打开开始菜单中的控制面板选择,在控制面板中选择并打开“程序”,找到并双击“打开或关闭Windows功能”,在d出的窗口中选择“Internet信息服务”下面所有选项,点击确定,然后就会开始更新服务,等待一会;
2、等待更新完成之后,打开浏览器,在浏览器地址栏上输入“>Windows Server 2003 中Internet 信息服务(IIS) 升级为IIS 60,其安全性更高。默认情况下,Windows Server 2003没有安装IIS 60,要通过控制面板来安装。具体做法为:
1 进入“控制面板”。
2 双击“添加或删除程序”。
3 单击“添加/删除 Windows 组件”。
4 在“组件”列表框中,双击“应用程序服务器”。
5 双击“Internet 信息服务(IIS)”。
6 从中选择“万维网服务”及“文件传输协议(FTP)服务”。
7 双击“万维网服务”,从中选择“Active Server Pages” 及“万维网服务”等。
安装好IIS后,接着设置Web服务器,具体做法为:
1 在“开始”菜单中选择“管理工具→Internet信息服务(IIS)管理器”。
2 在“Internet 信息服务(IIS)管理器”中双击“本地计算机”。
3 右击“网站”,在d出菜单中选择“新建→网站”,打开“网站创建向导”。
4 依次填写“网站描述”、“IP 地址”、“端口号”、“路径”和“网站访问权限”等。最后,为了便于访问还应设置默认文档(Indexasp、Indexhtm)。
上述设置和Windows 2000 Server网站设置基本相同,但此时Web服务还仅适用于静态内容,即静态页面能正常浏览,常用Active Server Pages(ASP)功能没有被启用。所以还应在“Internet 信息服务(IIS)管理器”的“ Web 服务扩展”中选择允许“Active Server Pages”。
另外,还应注意如果Web服务主目录所在分区是NTFS格式,而ASP网页有写入 *** 作时(如用到新闻后台管理功能的),要注意设置写入及修改权限。

import javaioBufferedReader;
import javaioIOException;
import javaioInputStreamReader;
import javanetInetAddress;
import javanetNetworkInterface;

/
与系统相关的一些常用工具方法

@author lvbogun
@version 100
/
public class SystemTool {

/
获取当前 *** 作系统名称 return *** 作系统名称 例如:windows xp,linux 等
/
public static String getOSName() {
return SystemgetProperty("osname")toLowerCase();
}

/
获取unix网卡的mac地址 非windows的系统默认调用本方法获取
如果有特殊系统请继续扩充新的取mac地址方法

@return mac地址
/
public static String getUnixMACAddress() {
String mac = null;
BufferedReader bufferedReader = null;
Process process = null;
try {
// linux下的命令,一般取eth0作为本地主网卡
process = RuntimegetRuntime()exec("ifconfig eth0");
// 显示信息中包含有mac地址信息
bufferedReader = new BufferedReader(new InputStreamReader(
processgetInputStream()));
String line = null;
int index = -1;
while ((line = bufferedReaderreadLine()) != null) {
// 寻找标示字符串[hwaddr]
index = linetoLowerCase()indexOf("hwaddr");
if (index >= 0) {// 找到了
// 取出mac地址并去除2边空格
mac = linesubstring(index + "hwaddr"length() + 1)trim();
break;
}
}
} catch (IOException e) {
eprintStackTrace();
} finally {
try {
if (bufferedReader != null) {
bufferedReaderclose();
}
} catch (IOException e1) {
e1printStackTrace();
}
bufferedReader = null;
process = null;
}
return mac;
}

/
获取widnows网卡的mac地址

@return mac地址
/
public static String getWindowsMACAddress() {
String mac = null;
BufferedReader bufferedReader = null;
Process process = null;
try {
// windows下的命令,显示信息中包含有mac地址信息
process = RuntimegetRuntime()exec("ipconfig /all");
bufferedReader = new BufferedReader(new InputStreamReader(
processgetInputStream()));
String line = null;
int index = -1;
while ((line = bufferedReaderreadLine()) != null) {
Systemoutprintln(line);
// 寻找标示字符串[physical
index = linetoLowerCase()indexOf("physical address");

if (index >= 0) {// 找到了
index = lineindexOf(":");// 寻找":"的位置
if (index >= 0) {
Systemoutprintln(mac);
// 取出mac地址并去除2边空格
mac = linesubstring(index + 1)trim();
}
break;
}
}
} catch (IOException e) {
eprintStackTrace();
} finally {
try {
if (bufferedReader != null) {
bufferedReaderclose();
}
} catch (IOException e1) {
e1printStackTrace();
}
bufferedReader = null;
process = null;
}

return mac;
}

/
windows 7 专用 获取MAC地址

@return
@throws Exception
/
public static String getMACAddress() throws Exception {

// 获取本地IP对象
InetAddress ia = InetAddressgetLocalHost();
// 获得网络接口对象(即网卡),并得到mac地址,mac地址存在于一个byte数组中。
byte[] mac = NetworkInterfacegetByInetAddress(ia)getHardwareAddress();

// 下面代码是把mac地址拼装成String
StringBuffer sb = new StringBuffer();

for (int i = 0; i < maclength; i++) {
if (i != 0) {
sbappend("-");
}
// mac[i] & 0xFF 是为了把byte转化为正整数
String s = IntegertoHexString(mac[i] & 0xFF);
sbappend(slength() == 1 0 + s : s);
}

// 把字符串所有小写字母改为大写成为正规的mac地址并返回
return sbtoString()toUpperCase();
}
}
写一个全局拦截的servlet,只要有请求的时候就调用这个类里面的获取mac地址的方法
String os = getOSName();
Systemoutprintln(os);
if (osequals("windows 7")) {
String mac = getMACAddress();
Systemoutprintln(mac);
} else if (osstartsWith("windows")) {
// 本地是windows
String mac = getWindowsMACAddress();
Systemoutprintln(mac);
} else {
// 本地是非windows系统 一般就是unix
String mac = getUnixMACAddress();
Systemoutprintln(mac);
}
记得判断一下是什么系统


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zz/12973860.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2025-08-29
下一篇2025-08-29

发表评论

登录后才能评论

评论列表(0条)

    保存