Asp.net webmethod作为web服务?
我有一个asp.net web应用程序(VS2010,C#),它的aspx页面有用于AJAX调用的webmethod(这里一切都很好)。
但我需要在 asp.net 应用程序之外使用这个 webmethod (GetEmployeeDetails) - 比如说,我需要将其用作另一个客户端应用程序的 Web 服务 - 这可能吗?
我当前在 .aspx.cs 页面中的 webmethod 代码是:-
:
using System.Web.Services;
:
public partial class EmployeeManagement_ViewLeaveList : System.Web.UI.Page
{
[WebMethod]
public static Object GetEmployeeDetails(int iEmpID)
{
:
:
return obj;
}
}
i have a asp.net webapplication (VS2010, C#) and it aspx page has webmethod that are used for AJAX call (all is fine here).
But i need to use this webmethod (GetEmployeeDetails) outside the asp.net application - say, i need to use this as webservice from another client application - is this possible??
My current webmethod code in .aspx.cs page is :-
:
using System.Web.Services;
:
public partial class EmployeeManagement_ViewLeaveList : System.Web.UI.Page
{
[WebMethod]
public static Object GetEmployeeDetails(int iEmpID)
{
:
:
return obj;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该服务将公开为
\EmployeeManagement_ViewLeaveList.aspx\GetEmployeeDetails
您可以使用它来由其他页面调用。但建议使用单独的服务来代替此服务。
the service will be be exposed as
\EmployeeManagement_ViewLeaveList.aspx\GetEmployeeDetails
You can use this to be called by other pages. However it is recommended to use separate service instead of this.