通过托管环境进行自托管
我试图通过weblistener运行ASP.NET Core(.NET 4.6.1)应用程序作为自托管
我添加了一个命令:
"commands": { "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000" },
和project.json
必要依赖项
当我通过Visual Studio启动我的应用程序时它工作正常
src\ProjectName\bin\Release\net461\win7-x64\ProjectName.exe
ProjectName.exe作为Web服务器启动,具有Hosting environment: Development
但是,当我手动运行它时, ProjectName.exe
与Hosting environment: Production
一起运行Hosting environment: Production
并且它无法正常运行。 首先,我想找到用Development environment
手动运行应用程序的Development environment
在VS我有这个选项:
启动应用程序时,Visual Studio将自动为您设置环境变量(基于属性文件夹中launchSettings.json的设置)。
当您从命令行运行或双击时,您需要使用setx ASPNETCORE_ENVIRONMENT "Development"
(命令行)或$Env:ASPNETCORE_ENVIRONMENT = "Development"
(Powershell) setx ASPNETCORE_ENVIRONMENT "Development"
设置环境变量。
- 从vNext中的appsetting.json读取启动外的连接字符串
- 如何禁用net core 2.1中的预编译视图进行调试?
- 你如何在ASP 5(vnext)中抛出HttpResponseException
- Asp.net 5 web api返回状态码和正文
- 在ASP.NET Core Web API中注册新的DelegatingHandler
- 从.NET Core运行PowerShell
- ASP.NET Core Routing适用于VS IIS Express,但不适用于IIS 10
- ASP.NET核心中的承载令牌认证
- 如何在ASP.NET Core 1.0的DI中的Startup类中添加IHttpContextAccessor?