简体   繁体   English

我们如何在没有 ASP.NET 的情况下使用 C# 和 JS 框架来开发单页应用程序?

[英]How can we use C# without ASP.NET with a JS framework for developing Single Page Applications?

I am looking for a way to use HTML , CSS , JS Framework like Angular or Vue in the front page and use C# without ASP.NET in the backend to develop Single Page Applications. I am looking for a way to use HTML , CSS , JS Framework like Angular or Vue in the front page and use C# without ASP.NET in the backend to develop Single Page Applications. Is there any possible way to do it?有什么可能的方法吗? I mean can we use C# without ASP.NET in the backend as an API and develop Single Page APPS?我的意思是我们可以在后端使用没有C#ASP.NET作为API并开发单页应用程序吗?

I googled it a lot but did not find any helpful resources so I came here to get help of the stackoverflow experience.我用谷歌搜索了很多,但没有找到任何有用的资源,所以我来这里是为了获得 stackoverflow 体验的帮助。

Thanks in advance for any help.提前感谢您的帮助。

Yes, ASP.NET is an entirely optional part of a .NET web application.是的,ASP.NET 是 .NET web 应用程序的完全可选部分。

Depending on how you want to host it, you can just let your code work in an Owin middleware, an IIS module or handler or a plain old HttpListener, and so on, causing "raw" HTTP requests to end up in your code.根据您希望如何托管它,您可以让您的代码在 Owin 中间件、IIS 模块或处理程序或普通的旧 HttpListener 等中工作,从而导致“原始” HTTP 请求最终出现在您的代码中。

You can then mix and match features from ASP.NET or third-party libraries such as routing, security, content negotiation (serialization), bundling and minification and effectively you'll be creating a Frankenstein monster that won't work as well as ASP.NET and that others can barely maintain.然后,您可以混合和匹配 ASP.NET 或第三方库(如路由、安全、内容协商(序列化)、捆绑和缩小)中的功能,您将有效地创建一个无法像 ASP.NET 那样工作的科学怪人怪物别人勉强维持。

At least one such framework already exists and is called "Nancy", and has all the drawbacks mentioned above, in addition to a barely maintained and poorly debuggable cousin of Razor.至少有一个这样的框架已经存在,被称为“Nancy”,除了几乎没有维护且难以调试的表亲 Razor 之外,它还具有上述所有缺点。

So the answer is "yes, but why?".所以答案是“是的,但为什么呢?”。

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

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