asp.net-core - 通过“dotnet”命令构建或发布,参数/参数指定 windows Authentication=true 和匿名 Authentication=false
问题描述
以下是有关我们开发环境的详细信息:
DevExpress 20.2.3(我们使用的是 DevExtreme)
Microsoft Visual Studio Enterprise 2019(版本 16.4.6)
ASP.NET 核心 3.1.0
AspNetCore.Mvc 3.1.0.0
Microsoft SQL Server 2008 R2 (RTM) –</p>
dotnet –版本 3.1.300
我们的部署服务器环境详细信息是:
Windows Server 2016 标准 64 位操作系统
dotnet –版本 3.1.300
IIS 版本 10
我们的目标是使用 dotnet 命令行构建和部署/打包:
Microsoft Windows [Version 10.0.17763.1697] (c) 2018 Microsoft Corporation. All rights reserved.
C:\Windows\system32>D:
D:>%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
** Visual Studio 2019 Developer Command Prompt v16.8.2 ** Copyright (c) 2020 Microsoft Corporation
D:>cd D:\AppCodeArena\StrangeAcmeApplication\
D:\AppCodeArena\StrangeAcmeApplication>dotnet --version
3.1.300
D:\AppCodeArena\StrangeAcmeApplication>dotnet clean
…..Output...blah….blah….blah…..Output... 0 errors
D:\AppCodeArena\StrangeAcmeApplication>dotnet build -c Release
--runtime win10-x64 .\StrangeAcmeApplication.Uploaders.sln
…..Output...blah….blah….blah…..Output... 0 errors
D:\AppCodeArena\StrangeAcmeApplication>dotnet publish .\src\StrangeAcmeApplication.Uploaders\StrangeAcmeApplication.Uploaders.csproj --runtime win10-x64 --no-build -c Release --output .\PublishedDirectory /p:DebugType=None /p:DebugSymbols=false /p:EnvironmentName=Development --self-contained true
适用于 .NET Core 的 Microsoft (R) Build Engine 版本 16.6.0+5ff7b0c9e 版权所有 (C) Microsoft Corporation。版权所有。
StrangeAcmeApplication.Uploaders -> D:\AppCodeArena\StrangeAcmeApplication\PublishedDirectory\
在 .\PublishedDirectory\appsettings.json 中有以下内容:
{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "AllowedHosts": "*" }
在 .\PublishedDirectory\appsettings.Development.json 中有以下内容:
{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "ConnectionStrings": { "dbConnectionString": "Data Source=BlahSQLServerBlah;Initial Catalog=BlahDatabaseInstanceBlah;Persist Security Info=True;User ID=blahUserNameblah;Password=blahblah"
} }
最后在 .\PublishedDirectory\web.config 中,我们有以下内容:
< ?xml version="1.0" encoding="utf-8"?> <configuration> <location path="." inheritInChildApplications="false" >
< system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\InvestorCentral.Uploaders.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
</system.webServer> </location> </configuration>
应用程序需要发布和部署以下内容:
窗户认证:真
匿名身份验证:假
D:\AppCodeArena\StrangeAcmeApplication>dotnet build -c Release --runtime win10-x64 .\StrangeAcmeApplication.Uploaders.sln
D:\AppCodeArena\StrangeAcmeApplication>dotnet publish .\src\StrangeAcmeApplication.Uploaders\StrangeAcmeApplication.Uploaders.csproj --runtime win10-x64 --no-build -c Release --output .\PublishedDirectory /p:DebugType=None /p :DebugSymbols=false /p:EnvironmentName=Development --self-contained true
有人可以告诉我如何使用带有参数/参数的“dotnet”命令构建或发布应用程序,这些参数还指定以下内容?
窗户认证:真
匿名身份验证:假
解决方案
@lex-li 和 @yiyi-you 感谢您的评论。
我觉得有点傻,因为问题是有问题的服务器需要安装 .NET Core Hosting Bundle(就我而言,它专门用于 x64 位的 .Net Core 3.1.12 Hosting Bundle):
推荐阅读
- ramda.js - Ramda - 使用 applySpec 访问地图的元素
- apache - Apache RewriteRule 不适用
- java - MultipleBagFetchException:不能同时获取多个包
- elasticsearch - 即使将单个标识符作为查询的一部分传递,NativeSearchQuery 也会返回所有结果
- php - 无法在 laravel 8 中显示模态形式
- python - 张量流模型和转换后的 tflite 之间的精度下降
- javascript - 如何在 chart.js 工具提示中显示额外数据?
- kotlin - Kotlin - 如何对列表中的特定元素求和?
- python - python中Web应用程序中的类实例用法
- javascript - Javascript如何在这个动画上使用while循环?