使用剃刀/ MVC3 asp.net生成静态html页面? [英] Use razor/asp.net mvc3 to generate static html pages?
问题描述
其一谟,我已经生成静态html的网页,这是会被远程服务器上发布。
For one projet, I've to generate static .html pages, which are gonna to be published on a remote server.
我已经从一个C#code,它从一个SQL Server数据库中提取数据自动化这些文件的创建。
I've to automate the creation of those files from a c# code, which takes data from a SQL Server database.
数据将不会经常改变(每4-5个月),而本网站将高度常去。
Data will be not often changed(every 4-5 month), and this website will be highly frequented.
因为我发现asp.net MVC3剃刀synthax非常有效的,我想知道是否有可能使用asp.net MVC3 /剃刀生成html的那些页面?
Since I find the razor synthax of asp.net MVC3 very effective, I was wondering if it's possible to use asp.net MVC3/Razor to generate those .html pages?
所以:
- 这是一个好主意?
- 如果是的,有什么好办法?
- 如果你觉得这样做,哪种方式的另一个很好的方式?
感谢您的帮助。
修改
对于答案,我需要做一个precision:我不想/需要使用Web缓存,对于很多的原因(负载(百万页每月加载),集成(我们整合我们的页面在优化了Apache,一个网站的另一部分),页数(缓存只会帮助我,如果我有同样的页面了很多时间,但我一定要有〜2500页,所以墨菲定律,除非我把一个非常高的缓存超时,我会经常来生成)。所以,我真的寻找的东西生成HTML页面。
Regarding answers, I need to make a precision: I don't want/need to use web caching, for a lot of reasons(load(millions of pages loaded every month), integration(we integrate our page in an optimized apache with, another part of a website), number of pages(caching will only help me if I've the same pages a lot of time, but I will have ~2500 pages, so with murphy's law, except if I put a very high cache timeout, I will have to generate them often). So I really search something to generate HTML pages.
编辑2
我刚刚得到一个新的约束:/那些模板必须本地化。也就是说,我应该有一些等同于以下剃刀code: @ MyLocalizationFile.My.MyValue
修改3
目前,我想这样做一个动态的网站,并调用一些HTTP查询就可以了,保存生成的HTML。但是,是否有办法避免HTTP?这意味着模拟HTTP调用,specifiy输出流,并要求(只有GET调用)的URL。
Edit 3 Currently, I'm thinking of doing a dynamic website, and call some http query on it, to store the generated HTML. BUT, is there a way to avoid the http? meaning simulate an http call, specifiy the output stream and the url called(with only GET call).
我们的previous负荷数字真的低估了,实际上他们有超过一百万的游客多一点的每一天,〜1400万的页面加载/天。
Our previous load numbers were really underestimated, actually they have a little more than one million visitor each days, ~ 14 million pages loads/day.
推荐答案
我通过创建一个正常的asp.net MVC的网站,然后通过与Web客户端页面上会产生页结束。
I ended by creating a normal asp.net MVC website and then generate page by going on the page with a WebClient.
喜欢我可以在网站的preVIEW,我可以享受剃刀+ MVC佣工的全部力量。
Like this I can have a preview of the website and I can enjoy the full power of Razor+MVC helpers.
这篇关于使用剃刀/ MVC3 asp.net生成静态html页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!