从一个应用程序调用另一个应用程序的 WebMethod?

发布于 2024-08-27 04:49:40 字数 52 浏览 5 评论 0原文

当两个应用程序都是用 C# 开发时,如何从另一个应用程序调用一个应用程序的 Web 方法?

How can I call a webmethod of one application from another application, when both are developed in C#?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

耳根太软 2024-09-03 04:49:42

通过 SOAP 或 REST 或 COM 或(老式的)CORBA 或...公开方法,

请做好准备,这样做会大大增加应用程序的复杂性。您开始必须适当担心安全性、所有部分如何交互以及许多其他问题。这里有很多深度,对于一个简单的答案来说太多了。

Expose the method through SOAP or REST or COM or (going old-school) CORBA or ...

Be prepared that doing this is a massive increase in the complexity of the applications. You start to have to worry properly about security, and about how all the pieces interact, and many other issues. There's a lot of depth here, far too much for a simple answer.

国际总奸 2024-09-03 04:49:42

这可以使用 WCF 而不是 Web 服务来完成

This can be done using WCF instead of webservice

两个我 2024-09-03 04:49:41

当然,你不能这样做。这将是一个巨大的安全漏洞。

正如您的标签所建议的,应用程序的开发人员有必要向世界显式公开他想要从其他应用程序调用的方法。这可以通过 WCF 或可能通过 COM 来完成。

或者,可以将要调用的代码放入类库中,并由两个项目引用。

You can't do this, of course. It would be a huge security hole.

As suggested by your tag, it would be necessary for the developer of an application to explicitly expose to the world the methods he wants to be called from other applications. This could be done through WCF, or possibly through COM.

Alternatively, the code to be called caould be placed into a class library, and referenced by both projects.

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