我有一個名爲Service1.cs包含C#文件中:如何調用一個簡單的Web服務
public class Service1 : System.Web.Services.WebService
{
[System.Web.Services.WebMethod]
public static String testMethod()
{
return "Hello";
}
}
我把這個代碼片段在我的helloworld.html文件:
<WebService Language="c#" Codebehind="Service1.cs"
Class="Service1.Service1">
我的目錄是http://localhost:8000/,有一個鏈接helloworld.html和一個鏈接,下載Service1.cs
什麼網址必須去去訪問我的testMethod()返回的字符串?
我試過http://localhost:8000/helloworld/testmethod,http://localhost:8000/helloworld/Service1/testmethod, 但我無法弄清楚如何到達從Web服務返回的字符串值。
在此先感謝。
其中是您的項目/應用程序中的代碼,您正在使用webservice的含義,意思是「Service1」,您需要創建一個Web服務的實例,重新使用以調用webservice'testMethod()'在C#WebService上做一個簡單的谷歌搜索教程很多很好的例子都在線以及 – MethodMan