简体   繁体   English

Angular2与IIS和没有Node.js

[英]Angular2 with IIS and without Node.js

I've been googling around for a few days, and I am still not entirely clear on what would be required for building an Angular2 website. 我一直在谷歌上搜索几天,而且我还不完全清楚构建Angular2网站需要什么。

I am interested in leveraging the SPA concept, using the Angular2 library from the front end GUI, but I am finding there are more and more layers to this onion. 我有兴趣利用SPA概念,使用前端GUI中的Angular2库,但我发现这个洋葱有越来越多的层。

Of relevant tutorials I have found, the first step was to install node.js. 在我发现的相关教程中,第一步是安装node.js. My understanding of node.js is that it's essentially an IIS replacement. 我对node.js的理解是它本质上是一个IIS替代品。 We currently are on a MS stack, with a lot of WCF, and Rest services (some that return JSON). 我们目前处于MS堆栈,具有大量WCF和Rest服务(一些返回JSON)。 Our team all uses TFS, and Nuget, and VS 2015. 我们的团队都使用TFS,Nuget和VS 2015。

Can I simply create a SPA in ASP.NET MVC, that uses Angular2, and calls these Rest services directly without going through node.js, and needing to know how NPM work? 我可以简单地在ASP.NET MVC中创建一个使用Angular2的SPA,并直接调用这些Rest服务而无需通过node.js,并且需要知道NPM如何工作? I was hoping that Angular2 was fairly simple, but it seems like it has a lot of strings attached (or I am looking at the wrong resources). 我希望Angular2相当简单,但似乎附加了很多字符串(或者我正在查看错误的资源)。

I guess one option would be to just go node.js, and ignore IIS entirely? 我想一个选择就是去node.js,完全忽略IIS? This would be a huge leap for the MS stack team I work with and systems team that are MS/IIS friendly. 对于与我合作的MS堆栈团队和MS / IIS友好的系统团队来说,这将是一个巨大的飞跃。

Thanks 谢谢

You do need to install node and learn to use npm to develop with Angular 2. However node is not simply a web framework. 您确实需要安装节点并学习使用npm来开发Angular 2.但是节点不仅仅是一个Web框架。 It happens to be the tool of choice for client-side web tooling (not only Angular 2). 它恰好是客户端Web工具的首选工具(不仅仅是Angular 2)。 You can run on IIS just fine and power the Angular 2 app with ASP.NET Web API but you need to compile your TypeScript, you need to bundle your scripts and manage these dependencies. 您可以在IIS上运行,并使用ASP.NET Web API为Angular 2应用程序提供支持,但是您需要编译TypeScript,您需要捆绑脚本并管理这些依赖项。 This is what you need node and npm (and a bunch of other tools you get via npm) for. 这就是你需要node和npm(以及你通过npm获得的一堆其他工具)。 Don't worry there is no need to develop the server code in node or even install node on your server. 不要担心没有必要在节点中开发服务器代码,甚至不需要在服务器上安装节点。 Think of node as your MSBuild + PowerShell and of npm as your Nuget. 可以将节点视为您的MSBuild + PowerShell,将npm视为您的Nuget。

Warning - Angular 2 is still a RC and it is not entirely stable and especially the know-how on how to setup things is still less than ideal. 警告 - Angular 2仍然是RC,它并不完全稳定,特别是关于如何设置东西的技术诀窍仍然不太理想。 It is even worse when you want to do things on the MS ecosystem not because it can't be done but because not many people have documented the steps. 当你想在MS生态系统上做事情时,情况更糟,不是因为它无法完成,而是因为没有多少人记录这些步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM