web服務例子總結

2021-10-27 17:18:32 字數 2328 閱讀 9208

windows服務建立,註冊,啟動,解除安裝

1. 新建乙個專案

2. 從乙個可用的專案模板列表當中選擇windows服務

3. 設計器會以設計模式開啟

4. 從工具箱的元件表當中拖動乙個timer物件到這個設計表面上 (注意: 要確保是從元件列表而不是從windows窗體列表當中使用timer)

5. 設定timer屬性,interval屬性200毫秒(1秒進行5次資料庫操作)

6. 然後為這個服務填加功能

7. 雙擊這個timer,然後在裡面寫一些資料庫操作的**

8. 將這個服務程式切換到設計檢視

9. 右擊設計檢視選擇「新增安裝程式」

10. 切換到剛被新增的projectinstaller的設計檢視

11. 設定serviceinstaller1元件的屬性:

1) servicename = my sample service

2) starttype = automatic (開機自動執行)

3)displayname 顯示在服務列表中的名字

12. 設定serviceprocessinstaller1元件的屬性 account = localsystem

13. 對應專案所在的bin\debug資料夾會生成exe檔案

14. 執行命令「

cd c:\windows\

安裝installutil.exe 「e:\vs2008 program\service\service\bin\debug\service.exe」

解除安裝installutil.exe /u 「e:\vs2008 program\service\service\bin\debug\service.exe」

15. 右擊桌面上「我的電腦」,選擇「管理」就可以打計算機管理控制台

16. 在「服務和應用程式」裡面的「服務」部分裡,你可以發現你的windows服務已經包含在服務列表當中了

17. 右擊你的服務選擇啟動就可以啟動你的服務了

附:註冊:

cd c:\windows\

安裝installutil.exe 「e:\vs2008 program\service\service\bin\debug\service.exe」

安裝installutil.exe 「e:\vs2008 program\service\service\bin\debug\service.exe」

解除安裝installutil.exe /u 「e:\vs2008 program\service\service\bin\debug\service.exe」

啟動服務

net start 服務名

因為服務是自己建的,要重建,所以要先刪除

解除安裝installutil.exe /u 「e:\vs2008 program\service\service\bin\debug\service.

exe」或sc delete "服務名稱"

重新安裝installutil.exe 「e:\vs2008 program\service\service\bin\debug\service.exe」

應用例項:

附程式:

1.建立乙個類庫用於應用程式呼叫

using system;

using

using system.linq;

using system.text;

using servicebusiness;

using system.data.oracleclient;

namespace servicebusiness

}}2.建立windows應用程式,啟動應用程式後,間隔性向資料庫插入資料

using system;

using

using

using system.data;

using system.diagnostics;

using system.linq;

using system.serviceprocess;

using system.text;

using servicebusiness;

using system.threading;

namespace windowsservice

protected override void onstart(string args)

protected override void onstop()

protected override void oncontinue()

protected override void onpause()

public void timercallback(object obj)}}

web伺服器的配置

實驗 web伺服器的安裝 配置與管理 一.實驗內容 1 在windows xp系統上安裝iis web伺服器軟體 2 根據實際情況對軟體進行配置 實驗要求 掌握iis的管理和配置 實驗報告 分析建立乙個簡單 的基本過程 二.實驗步驟 1 安裝iis 安裝條件 windows xp作業系統 系統安裝光...

基於XFire的Web服務實現

使用xfire編寫乙個簡單的web服務程式以及呼叫該web服務的程式。j a myeclipse 8.5 tomcat 6.0 使用xfire實現了計算矩形面積的程式,輸入長 寬兩個引數計算輸出矩形的面積,並編寫客戶端程式對此web服務進行呼叫。1.配置環境 安裝tomcat 6.0,將其加入到my...

web總結之程式

一 http協議 1 http是hyper text transfer protocol 超文字傳輸協議 的縮寫 http協議 hypertext transfer protocol,超文字傳輸協議 是用於從www伺服器傳輸超文字到本地瀏覽器的傳送協議 http是乙個應用層協議,由請求和響應構成,是...