同时开发 Web 服务和消费者

发布于 2024-12-04 21:30:19 字数 161 浏览 4 评论 0原文

我使用 Visual Studio 2010 professional 创建一个 WCF Web 服务和一个将使用该 Web 服务的 MVC 3 网站。

我该如何合理地这样做呢?我应该将它们作为单独的项目保留在同一解决方案中吗?我可以在开发时跳过在本地引用和运行服务,而只是像库一样使用它吗?

Using Visual Studio 2010 professional I'm creating a WCF web service and a MVC 3 web site that will consume that web service.

How would I reasonably go around doing that. Should I keep them as seperate projects in the same solution? Can I skip referencing and running the service locally while developing, just use it like a library?

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

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

发布评论

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

评论(1

小苏打饼 2024-12-11 21:30:19

我们每天都会这样做:

  • 创建单一解决方案
  • 添加类库项目并创建您的 Web 服务接口
  • 添加 WCF 服务库项目并为您的接口创建服务实现(参考您的服务接口项目)
  • 添加 MVC3 Web应用程序项目并在此处引用您的服务接口项目
  • 在您的 MVC3 Web 应用程序项目中,添加对服务实现的直接引用(在开发过程中,像库一样使用它)或添加对 WCF 服务库的服务引用(用于作为生产中的独立网络服务器)。

这提供了快速的开发周期,并且如果您坚持接口操作,那么当您需要投入生产或横向扩展时,还可以将 WCF 服务部署为单独的实体。

We are doing this on a daily basis like this:

  • Create single solution
  • Add a class library project and create your web service interface
  • Add a WCF service library project and create a service implementation for your interface (ref your service interface project)
  • Add a MVC3 web application project and reference your service interface project here also
  • In your MVC3 web application project add either a direct reference to the service implementation (during development, use it like a library) or add a service reference to your WCF service library (for running as a seperate webserver in production).

This gives a fast development cycle, and if you stick to the interface operations, also the possibility to deploy the WCF service as a separate entity when you need to go into production, or scale out.

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