Asp.net webmethod作为web服务?

发布于 2025-01-06 13:12:00 字数 480 浏览 3 评论 0原文

我有一个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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

×纯※雪 2025-01-13 13:12:00

该服务将公开为

\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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文