2016-12-30 58 views
0

我有以下asp.net方法,我想將其轉換爲.asmx Web服務。我如何做到這一點。請任何幫助。如何將ASP.NET方法轉換爲ASP.NET .asmx Web服務

public ActionResult AddCpty(string Id, string Type) 
{ 
    //code for Addcp 
    return result; 
} 

我想通過將[WebMethod]屬性放在方法的頂部來轉換它。

[WebMethod] 
public ActionResult AddCpty(string Id, string Type) 
{ 
    //code for Addcp 
    return result; 
} 

回答

0

靜態

[WebMethod] 
public static ActionResult AddCpty(string Id, string Type) { 
//code for Addcp return result; 
} 
0

嘗試假設你想ASP模板內訪問它,也許你還沒有註冊的路線?

See this link並找到您的路線正在您的項目中註冊的任何地方揭露該方法。

相關問題