我需要有关 WCF 和 n 层的建议

发布于 2024-08-29 18:23:25 字数 299 浏览 1 评论 0原文

首先,我对编程相当陌生,我已经构建了一些 asmx Web 服务,但对于如何设置 WCF Web 服务我有点迷失。在过去的几天里,我试图通过阅读 MSDN 上的大量文档/文章/视频来研究这个问题,但我仍然很困惑。

由于我当前的 Web 服务使用 IIS 托管在单独的盒子上,因此据我了解,我需要创建一个 WCF 库,然后在另一个 WCF 应用程序中引用该库,然后在 IIS 中托管该应用程序并从我的前端引用 WCF 应用程序?对我来说似乎是一个额外的步骤......?更不用说在我的本地盒子上开发时的痛苦了。

任何建议或正确方向的观点将不胜感激。谢谢!

First off, i'm fairly new to programming, I've built a few asmx web services but I am a little lost regarding how I should set up a WCF web service. I've tried to research this over the past couple days by reading through a lot of the documentation/articles/videos on MSDN but I'm still a confused.

Since my current web services are hosted on a separate box using IIS, from what I understand I need to create a WCF Library, then reference the Library in another WCF App and then host that app in IIS and reference the WCF App from my Front End? Seems like an extra step to me...? Not to mention a pain when developing on my local box.

Any advice or a point in the right direction would be very much appreciated. Thanks!

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

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

发布评论

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

评论(1

羁客 2024-09-05 18:23:25

WCF 为您提供了共享公共程序集的选项(即,您的服务和客户端都可以使用相同的域模型库),但这不是必要的步骤。

您可以通过 ASP.NET 托管 WCF 服务,与 ASMX 相同。 Visual Studio 中的“WCF 服务应用程序”项目模板默认以这种方式配置它 - 作为 IIS 中托管的 WCF 服务。

对于最常见的场景来说,它与 ASMX 确实没有什么不同。您创建 WCF 服务应用程序,将其部署到 Web 服务器,并在客户端应用程序中添加服务引用。导入器将自动为您生成类,因此您无需引用任何程序集。没有额外的步骤。

如果您还没有看过,您确实应该看一下 Microsoft 的教程。您会发现这些步骤与设置基于 ASMX 的架构的步骤非常相似。

WCF gives you the option of sharing common assemblies (i.e. so both your service and clients can use the same domain model library), but it's not a necessary step.

You can host a WCF service through ASP.NET, same as ASMX. The "WCF Service Application" project template in Visual Studio configures it this way by default - as a WCF service hosted in IIS.

For the most common scenarios, it's really no different from ASMX. You create a WCF Service application, deploy it to a web server, and add service references in client applications. The importer will automatically generate classes for you, so you don't need to reference any assembly. No extra steps.

If you haven't already, you really should have a look through Microsoft's Tutorial. You'll find the steps very similar to those for setting up an ASMX-based architecture.

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