通过 "dotnet" 命令构建或发布 arguments/parmaters 指定 windows Authentication=true 和匿名 Authentication=false
build or publish via"dotnet" command with arguments/parmaters specifying windows Authentication=true and anonymous 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
微软 SQL 服务器 2008 R2 (RTM) –
dotnet –版本 3.1.300
我们的部署服务器环境详细信息是:
Windows 服务器 2016 标准 64 位 OS
dotnet –版本 3.1.300
IIS 版本 10
我们的目标是使用 build & deploy/package 使用 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 Studio19\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
Microsoft (R) 构建引擎版本 16.6.0+5ff7b0c9e for .NET Core 版权所有 (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>
应用程序需要发布和部署以下内容:
windows 身份验证:真
匿名身份验证:假
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
有人可以告诉我如何使用带有 arguments/parmaters 的“dotnet”命令构建或发布应用程序吗?
windows 身份验证:真
匿名身份验证:假
@lex-li 和@yiyi-you 感谢您的评论。
我觉得有点傻,因为问题是有问题的服务器需要安装 .NET Core Hosting Bundle
(就我而言,它特别适用于 x64 位的 .Net Core 3.1.12 托管包):
以下是我们开发环境的详细信息:
DevExpress 20.2.3(我们正在使用 DevExtreme)
Microsoft Visual Studio Enterprise 2019(版本 16.4.6)
ASP.NET 核心 3.1.0
AspNetCore.Mvc 3.1.0.0
微软 SQL 服务器 2008 R2 (RTM) –
dotnet –版本 3.1.300
我们的部署服务器环境详细信息是:
Windows 服务器 2016 标准 64 位 OS
dotnet –版本 3.1.300
IIS 版本 10
我们的目标是使用 build & deploy/package 使用 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 Studio19\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
Microsoft (R) 构建引擎版本 16.6.0+5ff7b0c9e for .NET Core 版权所有 (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>
应用程序需要发布和部署以下内容:
windows 身份验证:真
匿名身份验证:假
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
有人可以告诉我如何使用带有 arguments/parmaters 的“dotnet”命令构建或发布应用程序吗?
windows 身份验证:真
匿名身份验证:假
@lex-li 和@yiyi-you 感谢您的评论。
我觉得有点傻,因为问题是有问题的服务器需要安装 .NET Core Hosting Bundle (就我而言,它特别适用于 x64 位的 .Net Core 3.1.12 托管包):