2010-03-25 70 views
1

我在asp.net編寫一個簡單的web服務代碼,當我建立服務並運行它正常工作的服務。當我嘗試訪問webservice它給一些問題,問題意味着我沒有得到該方法(web服務方法)。完成編寫webserivce我採取了一個asp.net頁面(.aspx),並在解決方案資源管理器中添加一個webservices,它被成功添加。但是當我添加命名空間它沒有得到服務名稱(我不能夠添加websercice的名稱空間簡單的web服務代碼?

回答

0

我不完全確定可能是什麼問題,但您應該只需要執行以下操作以使用Web服務:

// Look at what you named your web reference, in my example it is 
// called MyWebService. Check your solution explorer for the actual name. 
// This is the alias you should be using. 
MyWebService.YourWebServiceName ws = new MyWebService.YourWebServiceName(); 
var result = ws.MyMethod(someparameter); 
+0

雅實際上現在是本地主機我得到我的web服務,這是我的服務... localhost.Myservices objMyservice =新localhost.Myservices(); 但我沒有得到的WebMethod當我鍵入像「objMyservice」。 in intellisense我沒有收到webmethod – 2010-03-25 05:29:59

+0

謝謝你的迴應Mr.Kelsey – 2010-03-25 05:30:15

+0

確保您選擇了正確的對象來創建,而不是意外選擇其中一種類型。 – Kelsey 2010-03-25 05:35:58