Asp.net的Web API 2分离Web客户端和Web服务器的发展 [英] Asp.net web API 2 separation Of Web client and web server development

查看:167
本文介绍了Asp.net的Web API 2分离Web客户端和Web服务器的发展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的web应用程序是由2团队开发。一个团队工作在客户端,用它自己的分公司进行开发,并在服务器端的其他作品,也有它自己的开发分支。客户端和服务器是分开运行时,每一个作为一个不同的端口上的网站。该网站在开发期间接待了IIS防爆preSS,并在生产中,他们将运行在IIS。

Our web application is developed by 2 teams. One team works on the client side, with it's own Branch for development, and the other works on the server side, also with it's own development branch. The client and the server are running separately, each one as a website on a different port. The websites are hosted over IIS Express during development, and in production they will run over IIS.

我们的理想的情况是,每个队可以完全独立地发展,只要发展会议结束,两队合并,以整合,不是每个团队合并回到自己的开发分支的变化设置为一个共同的分公司,并继续

Our ideal situation is that each team can develop completely separately and whenever a develop session is over, both teams merge their change-set to a common Branch in order to integrate, than each team merges back to their development branch, and continues.

为了要充分分离,我们有X2 SERVER项目,一个处理真正的HTTP请求和另一个,一个存根服务器哪个响应的所有客户端的HTTP用默认值要求,只是为了使客户端团队可以测试自己的code,而不依赖于服务器的功能。

In order for a full separation, We have x2 SERVER projects, one to handle the real HTTP requests and another one, a "Stub server" Which responses to all the clients HTTP requests with default values, just in order so that the Client side team can test their code without being dependent on the functionality of the server.

的问题是,无论是存根服务器和真实服务器和使用的客户端侧项目被引导到相同的端口

The problem is that both the "Stub server" and the real server and using the same Port which the Client side project is directed to.

这会导致运行的存根服务器,而不是真实的,在审查申请的多​​烦人的错误(主要用于服务器方队),测试等,对我们来说,唯一的解决办法是手动创建一个虚拟目录运行之前每一次真正的Web服务器项目/或找出后,我们运行错误的服务器。

This causes many annoying mistakes (mostly for the Server side team) of running the application with the "Stub server" instead of the real one, during reviews, tests etc. The only solution for us is to manually create a virtual directory for the real web server project every time before running / or after finding out we were running the wrong server.

有一个更聪明的解决方案,以解决这个恼人的问题?这将提高我们的生活!

Is there a smarter solution to overcome this annoying problem? That would improve our lives!

如果什么我说的是愚蠢的/还不清楚,请大家指正(我是新来的这一点),或要求更多的细节,我会很高兴!

If anything I said was foolish / not clear please correct me (I'm new to this), or ask for more details, I'll be glad!

感谢帮手!

推荐答案

我相信你的问题是要建立自动化然后服务器配置更有关。你真的应该保持的存根服务器的和的真正的服务器的成单独的端口,以及一些客户端的构建过程期间更改端口。

I believe your problem is more related to build automation then server configuration. You should really keep the stub server and the real server into separate ports, and change that port during some kind of build process of your client.

如果您使用的是AngularJS,那么我建议你使用通用的工具,如一饮而尽咕噜以创建步骤到您的客户端应用程序的构建过程。你可以创建一个将设置一个全局变量或修改常量(如API端点)并将其命名为本地测试(指向你的客户存根服务器)和整合(对于真正的服务器)。

If you are using AngularJS, then I suggest you to create steps into the build process of your client application using common tools like gulp or grunt. You could create build processes that will set a global variable or modify a constant (e.g. the API endpoint) and name them local testing (pointing your client to the stub server) and integration (for the real server).

请注意,您可以轻松的整合那些构建过程到Visual Studio ,使他们的全局调试/生成过程的一部分。

Please note that you can easily integrate those build processes into Visual Studio, making them part of your global debug/build process.

这是替换任何文件中的文本有用的一个简单的任务,一饮而尽:的https:// WWW .npmjs.com /包/吞掉替换

Here it is a simple gulp task useful for replacing text inside any file: https://www.npmjs.com/package/gulp-replace

这篇关于Asp.net的Web API 2分离Web客户端和Web服务器的发展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆