尝试在 macOS 上启动现有项目时获取 "ApplicationHost.cs file not found"

Getting "ApplicationHost.cs file not found" when trying to start existing project on macOS

ASP.NET这里是新手。

以前从未遇到过,但现在我面临着对现有应用程序进行一些调整的迫切需要。我的平台是OS X。我知道 ASP.NET 主要用于 windows,但仍然研究了互联网并且它在寻找我,它仍然可以 运行 它在我的 mac.

当我运行一个项目时,我得到一个错误:

ApplicationHost.cs file is not found

我的调用堆栈如下所示:

System.Web.Hosting.ApplicationHost.CreateApplicationHost(System.RuntimeType hostType, string virtualDir, string physicalDir)
Mono.WebServer.VPathToHost.CreateHost(Mono.WebServer.ApplicationServer server, Mono.WebServer.XSPWebSource webSource)
Mono.WebServer.XSP.Server.DebugMain(string[] args, bool root, Mono.WebServer.IApplicationHost ext_apphost, bool quiet)
Mono.WebServer.XSP.Server.DebugMain(string[] args)
Mono.WebServer.XSP.Server.Main( Parameters)

我研究了 XSP 服务器,但看起来它已从 homebrew 中删除,所以我觉得自己被卡住了。有没有什么方法可以在 Mac 上 运行 没有 windows 虚拟 machine?

我已准备好提供您需要的任何其他信息,但我只是不知道了解什么是重要的

在此先感谢您的任何帮助

据我所知,使用 Mono 不太舒服 似乎有两种解决方案

  1. 使用 Windows 在 Windows
  2. 上继续开发
  3. 将项目移植到 ASP.NET Core

虽然在 ASP.NET WebForms (aspx) 上工作时在 VS Mac 中有它的怪癖,但它可以在一定程度上工作。您会收到一些像这样的不清楚的错误消息。

在我的例子中,"just" 是 web.config 文件中的一个错误(我确实将连接字符串元素错误地放入了 system.web)。

所以我的建议是:如果可以的话,在 Windows 中使用 VS,但是如果你不介意像这样的错误,你 可以 使用 VS Mac这些。

解决您的问题:倒回您所做的更改,直到弹出此错误。它也可能在您的 web.config 中。