简体   繁体   English

有没有ASP.NET for C#web开发的替代品?

[英]Are there alternatives to ASP.NET for C# web development?

Lately, I've been thinking that I'd like to try some new ideas and a new approach to web application design. 最近,我一直在想,我想尝试一些新的想法和一种新的Web应用程序设计方法。 I'm mostly used to using ASP.NET (.NET 2.0) but I've toyed with the ASP.NET MVC library a little bit as well. 我大多习惯使用ASP.NET(.NET 2.0),但我也玩过一些ASP.NET MVC库。 While both are powerful and interesting, I'd really like something more... basic. 虽然两者都很强大而且很有趣,但我真的更喜欢更基本的东西。

Is there anything like that out there? 那里有类似的东西吗? I'd like a framework that's more transparent really: I want to be able to see the request, pass it where I want, render HTML the way I want, and post requests how I want. 我想要一个更透明的框架:我希望能够看到请求,将其传递到我想要的地方,以我想要的方式呈现HTML,并发布请求我想要的方式。 I can get all that in ASP.NET, but I have to dig pretty hard to get at all of it. 我可以在ASP.NET中获得所有这些,但我必须非常努力地去挖掘它。 I'd like something simpler to use as the basis for some new framework ideas. 我想用一些简单的东西作为一些新框架思想的基础。

So is there something like that out there? 那里有类似的东西吗? Or would I pretty much have to completely reinvent all the basic routing, request, and response code as well to get a platform to build up from? 或者我是否必须完全重新发明所有基本的路由,请求和响应代码以及从中获得一个平台?

我不确定它是否符合您的要求,但您绝对可以查看Manos

It's not answering the question but I really strongly think you're making a mistake here. 它没有回答这个问题,但我真的强烈认为你在这里犯了一个错误。

MVC lets you deal with rendering in the way you want (it's not like the bad old webforms), HttpHandlers let you deal with Requests and Responses as low down as makes reasonable sense (to me). MVC允许你以你想要的方式处理渲染(它不像糟糕的旧webforms), HttpHandlers让你处理请求和响应尽可能低(对我而言)。 99 times out of 100 you don't want to have to deal with the raw raw data coming from the web server (and what is raw anyway? "Request" is an abstraction itself...). 100个中有99个你不想处理来自Web服务器的原始原始数据(无论如何都是原始数据?“请求”本身就是一个抽象......)。

I think you have to look long and hard at your motivation and consider the practical costs if you could get there. 我认为你必须长时间坚持你的动力并考虑实际成本,如果你能到达那里。

你应该看看Fubu MVC然后是FubuMVC

I would say if you are set on C# as your language ASP.net MVC is as good as it gets right now. 我会说如果你使用C#作为你的语言ASP.net MVC就像它现在一样好。 You may want to experiment with other template engines like Spark or Nhamle. 您可能想要尝试其他模板引擎,如Spark或Nhamle。

I would go and implement an HTTP handler using ASHX files . 我会去使用ASHX文件实现一个HTTP处理程序 It gives all the power of ASP.NET object model but do not limit you on any special way of handling the request. 它提供了ASP.NET对象模型的所有功能,但不限制您处理请求的任何特殊方式。

If you are looking for alternate frameworks you might want to have a look at Nina 如果您正在寻找替代框架,您可能想看看Nina

https://github.com/jondot/nina https://github.com/jondot/nina

From the website: 来自网站:

Nina is a web microframework for the .Net platform, inspired by Sinatra. Nina是.Net平台的网络微框架,受Sinatra的启发。 It includes several aspects that go futher beyond Sinatra, such as an abstract, pluggable, and extensible infrastructure. 它包括几个超越Sinatra的方面,例如抽象,可插拔和可扩展的基础架构。

  • A simple to use DSL, a simple programming model. 一个简单易用的DSL,一个简单的编程模型。
  • Performance as a goal. 以绩效为目标。
  • Multiple pluggable view engines. 多个可插拔视图引擎。
  • Many scenarios covered by Json and XML serialization support. Json和XML序列化支持涵盖的许多场景。
  • Advanced cache-control for a RESTful ecosystem; RESTful生态系统的高级缓存控制; automatic ETagging and Last-Modified controls. 自动ETagging和Last-Modified控件。
  • Nina is intentionally build against the .Net 2.0 runtime in order to afford a lower barrier of entry!. Nina是故意针对.Net 2.0运行时构建的,以便提供更低的入门门槛! A port of Nina for the 4.0 runtime will be available shortly. 不久将提供适用于4.0运行时的Nina端口。
  • Razor support note: I chose to use RazorEngine, which is an open-source abstraction of a Razor view engine without using the full MVC stack. Razor支持说明:我选择使用RazorEngine,它是Razor视图引擎的开源抽象,不使用完整的MVC堆栈。 In that implementation, view data is exposed as 'Model'. 在该实现中,视图数据公开为“模型”。 I chose to align other views and now each view has its view data accessible by 'Model' and 'ViewData' members (except Razor). 我选择对齐其他视图,现在每个视图都有“模型”和“ViewData”成员(Razor除外)可以访问的视图数据。

Although this is a relatively old question, I would like to add some other frameworks that are worth a look: 虽然这是一个相对古老的问题,但我想补充一些值得一看的其他框架:

  • MonoRail is older than Asp.NET MVC and very similar to it. MonoRail比Asp.NET MVC更老,与它非常相似。 They are currently working on Version 3 of MonoRail. 他们目前正在开发MonoRail的第3版。 I used MonoRail Version 2 for a side project and it was a nice experience. 我使用MonoRail版本2进行侧面项目,这是一个很好的体验。
  • OpenRasta . OpenRasta I have no experience with this right now. 我现在没有这方面的经验。
  • TinyWeb . TinyWeb An excellent Asp.NET Micro Framework (You may find the comparison of .NET Microframeworks interesting (including the Anna and Jessica web frameworks)) 一个优秀的Asp.NET Micro Framework(您可能会发现.NET Microframeworks的比较很有趣(包括AnnaJessica Web框架))

I think you want the WebMatrix . 我想你想要WebMatrix

It's basicly a very simple (ASP like) model, but then coded with C# / .Net, and you get the @Razor syntax. 它基本上是一个非常简单的(类似ASP)模型,但随后用C#/ .Net编码,你就得到了@Razor语法。

There is the ASP.net Model View Presenter which may be something like what you are looking for. ASP.net模型视图演示器可能与您正在寻找的东西类似。

http://www.codeproject.com/KB/architecture/ModelViewPresenter.aspx http://www.codeproject.com/KB/architecture/ModelViewPresenter.aspx

It sounds to me like you're looking for a microframework like Sinatra , but in c# instead of Ruby. 听起来像你正在寻找像Sinatra这样的微框架 ,但在c#而不是Ruby中。 I am not aware of any such framework. 我不知道任何这样的框架。

I recommend you dive into Sinatra itself. 我建议你潜入Sinatra本身。 Learning Ruby will help expand you as a developer, you'll be closer to the HTTP metal (which sounds like what you want), and it'll be fun. 学习Ruby将有助于扩展您作为开发人员,您将更接近HTTP金属(这听起来像你想要的),它会很有趣。 The minimalism and simplicity that it sounds like you're looking for is much more popular in the Ruby community. 这听起来像你正在寻找的极简主义和简单性在Ruby社区中更受欢迎。

If you can use mono. 如果你可以使用单声道。 Then you can try Mongrel2 with dot net bindings. 然后你可以尝试使用点网绑定的Mongrel2。 It is very fast language agnostic web server. 它是非常快速的语言无关的Web服务器。 It works via zeroMQ. 它通过zeroMQ工作。

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

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