创建使用 .Net Core 的 NextJS 项目。

huangapple go评论80阅读模式
英文:

Create NextJS with .Net Core

问题

我需要创建一个解决方案,其中前端使用NextJS,后端使用.NET6。
我希望它们能够在同一个解决方案中创建,这样它们就可以在一个使用IIS10的网站上托管。

我看到Visual Studio 2022有一个React的模板。我尝试使用它,删除了React应用程序,并安装了NextJS。但是我遇到了一个错误,说找不到代理。
我还编写了server.js,但似乎VS始终在使用Microsoft SPA库。

是否有一个使用NextJS和.NET的模板,其中代理配置已经准备好并设置好了?

英文:

I need to create a solution that has its frontend in NextJS and its backend in .NET6.
I need them to be created in one solution, so they can be hosted in one website using IIS10.

I see that visual studio 2022 has a template for React. I tried to use it, and removed the React app and installed NextJS instead. But I have an error saying that the proxy cannot be found.
I also had written server.js but it seems that VS is always using Microsoft SPA lib.

Is there a template for working with NextJS and .NET with the proxy configuration ready and setup?!

答案1

得分: 1

Visual Studio没有针对Next.js和.NET的集成模板。这是一个有趣的问题,我找到了一些相关资源,让我分享给你。

1. Next.js meets ASP .NET Core — a story of performance and love at long tail

2. SPA-Identity-Server-Authenticate-Sample

3. NextjsStaticHosting-AspNetCore

英文:

Visual Studio not have a specific built-in template for working with Next.js and .NET together out of the box.

It's a interesting question, and I have found something, let me share you.

1. Next.js meets ASP .NET Core — a story of performance and love at long tail

2. SPA-Identity-Server-Authenticate-Sample

3. NextjsStaticHosting-AspNetCore

答案2

得分: 0

我已经搜索了一段时间,得出了一些结论:

  • 在这种情况下无法使用SSR。
  • Visual Studio没有适用于此的模板。
  • 我们可以使用SSG,请查看这个链接:https://github.com/NetCoreTemplates/nextjs,但这将使用serviceStack.net。
  • 在NuGet网站上有一个名为"x"的工具,用于设置模板。
英文:

I have been searching for a while and I came up with some conclusions:

  • SSR can not be used in this case.
  • VS has no template for this.
  • We can use SSG, check this :https://github.com/NetCoreTemplates/nextjs
    but this will use serviceStack.net.
    There is a tool named "x" on the NuGet website, that is used to setup the template.

huangapple
  • 本文由 发表于 2023年7月27日 16:45:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/76778001.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定