简体   繁体   English

IIS Express 与 dotnet 运行

[英]IIS Express vs dotnet run

Actually I understand that IIS Express is lightweight development server.其实我知道IIS Express是轻量级的开发服务器。 From the other side "dotnet run" runs the application as a console application and binds it to random port.另一方面, “dotnet run”将应用程序作为控制台应用程序运行并将其绑定到随机端口。

But what is the actual difference?但实际的区别是什么? I can launch big enterprise application by IIS Express and by "dotnet run" and both cases work perfectly.我可以通过IIS Express"dotnet run"启动大型企业应用程序,这两种情况都可以完美运行。

Till now all the difference I see is that IIS Express adds icon to the taskbar and dotnet run allows to see console output.到目前为止,我看到的所有不同之处在于IIS Express将图标添加到任务栏,而dotnet run允许查看控制台输出。 But those are minor differences.但这些都是细微的差别。 It should be some global ones why IIS Express is so widespread nowadays.现在 IIS Express 如此普遍的原因应该是一些全球性的。

Some structurization can be found here: ASP.NET Core launch settings: IIS Express, IIS, Project, Executable .可以在此处找到一些结构化: ASP.NET Core 启动设置:IIS Express、IIS、Project、Executable But it still doesn't explain the difference.但它仍然不能解释差异。

dotnet run will use the embedded Kestrel server. dotnet run将使用嵌入式 Kestrel 服务器。 IIS Express will use IIS Express as a reverse proxy which calls Kestrel behind the scenes. IIS Express 将使用 IIS Express 作为反向代理,在后台调用 Kestrel。 In either case a server is hosting your app.在任何一种情况下,服务器都在托管您的应用程序。

You can toggle your local server choice by adjusting the run configuration.您可以通过调整运行配置来切换本地服务器选择。 IIS Express will use...IIS Express. IIS Express 将使用...IIS Express。 But if you instead select the project (in the case of the screenshot, it's titled weatherapi ) it will use Kestrel instead.但是,如果您改为选择项目(在屏幕截图的情况下,它的标题为weatherapi ),它将改用 Kestrel。 You'll see a command prompt pop up, showing some basic configuration data (assuming you haven't changed the default logging output).你会看到一个命令提示符弹出,显示一些基本的配置数据(假设你没有更改默认的日志输出)。 The first time it's run, you may have to accept/install the localhost TLS certificate, so that you don't run into TLS errors.第一次运行时,您可能必须接受/安装 localhost TLS 证书,以免遇到 TLS 错误。

在此处输入图片说明

One way of confirming which process you are using, is to call get-process in powershell, along with either iisexpress or {nameOfProject}确认您正在使用哪个进程的一种方法是在 powershell 中调用get-process以及iisexpress{nameOfProject}

在此处输入图片说明

More info from the docs https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/?view=aspnetcore-3.1&tabs=windows来自文档https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/?view=aspnetcore-3.1&tabs=windows 的更多信息

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

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