Asp.net web API 2 separation Of Web client and web server development

浪尽此生 提交于 2019-12-24 08:29:13

问题


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.

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.

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!

Thanks for helpers!


回答1:


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.

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

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

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



来源:https://stackoverflow.com/questions/36664393/asp-net-web-api-2-separation-of-web-client-and-web-server-development

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!