在Visual Studio 2005 簡易使用 Web Service1. 產生Web Service 專案
1.1 使用C# 建立Web Service 專案
1.2 修改Namespace 和WebService的Service名稱
1.3 按F5執行時會開起執行的網頁,而網頁這時候的結果:

1.4 Method說明
修改WebMethod 加上Description
結果:多了My First WebService Say Hello描述
2. 使用Client呼叫Web Service
建立一個Windows Application專案
2.1 加入Web 參考

輸入URL:

結果:
2.2 Call Web Server - Hello Word
執行結果:

2.2 呼叫的Web Service 位址改變
如Web Service的位址是會變動的(從測試機台到正式機台),可以改變Url屬性的值
3. 使用Session
3.1 Server Code 加入Session的邏輯
3.2 Client 加入存Session的邏輯
Client端要 new 一個CookieContainer才會把Session的值存下來
4. 權限管理
4.1 Web Server 在Class一產生出來就判斷,使用Header
4.2 在Client端新增一個Proxy繼承RiceService,用來產生帳號和密碼的Header

原先用Web Servic的地方改為使用Proxy
5.Web Service 搬到IIS Service
5.1 Vista 的步驟



設定完看是X的樣式可以重新啟動他

在重新啟動後試著連上去剛被我們啟動的Web Service


發生了Access Deny的Exception :這是因為我們在程式裡面的寫法是要利用帶Heardr ,Header裡面要有帳號和密碼的資訊。
而我們直接使用Web測試,所以才會有這樣的狀況。
5.2 XP 設定的方式


Other:
1.Client 在使用Web Service的服務時會有TimeOut的情形發生,可以設定用web 參考得到的Web Service Class中的timeout屬性,來決定要等待的時間。(試過設成-1就不會有client 等待過久變成timeout的Exception)
2.Code