简体   繁体   English

将ASP.NET Core MVC应用程序集成到现有的ASP.NET MVC应用程序中

[英]Integrate ASP.NET Core MVC Application to existing ASP.NET MVC Application

I am having an existing ASP.NET MVC application running in production. 我正在生产中运行现有的ASP.NET MVC应用程序。 Now my customer came up with a new requirement/enhancement, and he wants to develop it with ASP.NET Core MVC. 现在我的客户想出了一个新的需求/增强功能,他想用ASP.NET Core MVC开发它。 New enhancement will be a new standalone module. 新的增强功能将成为一个新的独立模块。 And after development completion, he wants to integrate it with existing ASP.NET MVC application. 在开发完成后,他希望将其与现有的ASP.NET MVC应用程序集成。

I wanted to know that, is it possible to integrate these two applications, because ASP.NET Core is completely different framework rewritten from scratch, and old application uses .NET Framework 4.6.x. 我想知道,是否可以集成这两个应用程序,因为ASP.NET Core是从头开始重写的完全不同的框架,旧应用程序使用.NET Framework 4.6.x.

Any help or any kind of link that guides me on this will be very much appreciated. 任何帮助或任何类型的链接,指导我这将非常感谢。

Thanks in advance. 提前致谢。

Anand Neema Anand Neema

Your question is actually quite broad, because "integration" is a broad topic. 你的问题其实很广泛,因为“整合”是一个广泛的话题。 It covers many different aspects of the application and the exactly methodology depends on the an intimate knowledge of those applications. 它涵盖了应用程序的许多不同方面,确切的方法取决于对这些应用程序的深入了解。

That said, generally speaking, ASP.NET MVC and ASP.NET Core are completely separate platforms. 也就是说,一般来说,ASP.NET MVC和ASP.NET Core是完全独立的平台。 You cannot "integrate" them in the sense of how you use to be able to simultaneously run Web Forms and MVC code in the same ASP.NET MVC project. 您无法“集成”它们,因为您可以在同一个ASP.NET MVC项目中同时运行Web窗体和MVC代码。 They will be two separate applications that will need to be deployed independently. 它们将是两个独立的应用程序,需要独立部署。

You can "share" the connection string, which is to say you can share the database, but you will need to make a number of decisions in that regard. 您可以“共享”连接字符串,也就是说您可以共享数据库,但是您需要在这方面做出一些决定。 For example, if the current MVC project uses EF6, you will need to also use EF6 in the Core project in order to share the same entity classes. 例如,如果当前MVC项目使用EF6,则还需要在Core项目中使用EF6以共享相同的实体类。 That means, for the moment, targeting .NET Framework, rather than .NET Core. 这意味着,目前,目标是.NET Framework,而不是.NET Core。 However, .NET Core 3.0 promises to run EF6 natively. 但是,.NET Core 3.0承诺本机运行EF6。 Alternatively, you can use EF Core and treat the database as existing, scaffolding in the entities. 或者,您可以使用EF Core并将数据库视为实体中的现有脚手架。 This will result in some code duplication, but may be an acceptable compromise, depending on the circumstances. 这将导致一些代码重复,但可能是可接受的折衷,具体取决于具体情况。

Things like sessions, cookies, and auth can be shared, but it may require fundamental changes to the ASP.NET MVC project. 会话,cookie和auth之类的东西可以共享,但它可能需要对ASP.NET MVC项目进行根本性的更改。 Namely, ASP.NET Core uses data protection providers for encryption and decryption, rather than the machine key approach of ASP.NET. 也就是说,ASP.NET Core使用数据保护提供程序进行加密和解密,而不是ASP.NET的机器密钥方法。 However, via its support of OWIN, ASP.NET MVC5 can also support data protection providers for encryption/decryption. 但是,通过其对OWIN的支持,ASP.NET MVC5还可以支持数据保护提供程序进行加密/解密。 As such, if you switch over to using data protection there, and share the key ring between the two apps, then each will be able to decrypt things encrypted by the other. 因此,如果您切换到在那里使用数据保护,并在两个应用程序之间共享密钥环,那么每个应用程序将能够解密由另一个加密的内容。 However, if you aren't already using data protection in your MVC app, then the change could be somewhat painful. 但是,如果您尚未在MVC应用程序中使用数据保护,那么更改可能会有些痛苦。

If you only care about sharing auth, that can be achieved alternatively via a centralized auth provider such as Identity Server. 如果您只关心共享身份验证,则可以通过集中式身份验证提供程序(如Identity Server)来实现。 That would allow the two apps to operate independently of each other but still share a common user/role store and support SSO. 这将允许两个应用程序彼此独立运行,但仍共享一个共同的用户/角色存储并支持SSO。 However, that too, may require some substantial changes to the existing MVC app. 但是,这也可能需要对现有MVC应用程序进行一些实质性更改。 It's all trade-offs. 这都是权衡取舍。

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

相关问题 我可以将 ASP.NET Core MVC 添加到现有的 ASP.NET Web Z645024253191A381C36Z83CAE8 - Can I add ASP.NET Core MVC to existing ASP.NET Web Forms Application 将CMS集成到ASP.NET MVC Web应用程序中? - Integrate CMS into ASP.NET MVC web application? 将ASP.Net Core集成到WPF应用程序中 - Integrate ASP.Net Core into an WPF application 我可以在Docker中运行现有的ASP.NET MVC应用程序而无需在Linux中转换为ASP.NET Core - Can I run existing ASP.NET MVC application in Docker without converting to ASP.NET Core in Linux 更改现有Asp.Net MVC 5(身份2)应用程序的种子方法? - Change seed method for an existing Asp.Net MVC 5 (Identity 2) application? 现有ASP.NET MVC应用程序中的ADFS实现 - ADFS implementation in existing asp.net mvc application 使用现有 ASP.NET MVC 应用程序进行 Google 登录 - Google Sign-in with existing ASP.NET MVC Application 防止在启动后重定向 ASP.NET Core MVC 应用程序 - Prevent redirecting ASP.NET Core MVC Application after start 将WCF服务添加到ASP.NET Core MVC应用程序 - Add WCF service to ASP.NET Core MVC application ASP.Net Core MVC Web 应用程序角色管理 - ASP.Net Core MVC Web application roles management
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM