2011-05-20 53 views
0

我創建了一個Web服務,一旦我測試了默認的HelloWorld方法正確調用我的AJAX方法,我刪除它,添加另一種方法,並重新運行步驟說明hereWeb服務只接受HelloWorld作爲方法名

現在,我收到此錯誤。

錯誤:500 - System.InvalidOperationException:LoadAllFeeds Web服務方法名無效。 at System.Web.Services.Protocols.HttpServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type,HttpContext context,HttpRequest request,HttpResponse response) at System.Web.Services.Protocols .ServerProtocolFactory.Create(類型類型,HttpContext的背景下,要求的HttpRequest,HttpResponse對象響應,布爾& abortProcessing) - 內部服務器錯誤

但是,當我帶回來的方法名的HelloWorld(並再次運行在MSDN文檔中的步驟)它沒問題。

我一無所知,我希望有人能夠幫助我。謝謝!

+0

什麼是你正在嘗試其他的名稱上寫[WebMethod]? – emaillenin 2011-05-20 13:18:21

+0

LoadAllFeeds(如上所述),LoadFeeds,GetAllFeeds等。 – SajmiraZ 2011-05-24 02:33:04

+0

嘗試HelloWorld1 – emaillenin 2011-05-24 05:14:00

回答

1

在功能上像

[WebMethod] 
    public string HelloWorld() { 
     return "Hello World"; 
    } 

    [WebMethod] 
    public List<Employee> GetAllEmployees() 
    { 
     return list; 
    }