2016-12-30 76 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并找到您的路线正在您的项目中注册的任何地方揭露该方法。