0
votes

Here are the details about our development environment:

DevExpress 20.2.3 (we are using DevExtreme)

Microsoft Visual Studio Enterprise 2019 (Version 16.4.6)

ASP.NET Core 3.1.0

AspNetCore.Mvc 3.1.0.0

Microsoft SQL Server 2008 R2 (RTM) –

dotnet –version 3.1.300

Our Deployment Server environment details are:

Windows Server 2016 Standard 64-bit OS

dotnet –version 3.1.300

IIS version 10

We aim to use build & deploy/package using dotnet commandline:

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

Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Core Copyright (C) Microsoft Corporation. All rights reserved.

StrangeAcmeApplication.Uploaders -> D:\AppCodeArena\StrangeAcmeApplication\PublishedDirectory\

Within the .\PublishedDirectory\appsettings.json is the following content:

{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "AllowedHosts": "*" }

Within the .\PublishedDirectory\appsettings.Development.json is the following content:

{ "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"

} }

Finally within the .\PublishedDirectory\web.config, we have the following content:

< ?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> 

The application needs to be published and deployed the following:

windows Authentication : true

anonymous Authentication : false

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

Could someone please tell me how to build or publish the application using the "dotnet" command with arguments/parmaters that also specify the following?

windows Authentication : true

anonymous Authentication : false

1
I found a link about it,and dotnet publish will not include windows authentication in web.config.And you can refer to what guardrex said since config in IIS Manager modifies the web.config to include those settings.Yiyi You

1 Answers

0
votes

@lex-li and @yiyi-you Thank you for your comments.

I feel kind of silly because the problem was that the server in question needed to have .NET Core Hosting Bundle installed on it (For my case, it's specifically .Net Core 3.1.12 Hosting Bundle for x64 bit ):

https://dotnet.microsoft.com/download/dotnet-core/3.1