NuGet / NuGetGallery

NuGet Gallery is a package repository that powers https://www.nuget.org. Use this repo for reporting NuGet.org issues.
https://www.nuget.org/
Apache License 2.0
1.55k stars 644 forks source link

Setup-DevEnvironment - appCmd can't find applicationHost.config #4127

Closed glaisne closed 6 years ago

glaisne commented 7 years ago

Everything was going fine until I ran Setup-Dev-Environment.ps1 script. The AppCmd call couldn't find '\Documents\IISExpress\config\applicationHost.config'.

Below is my log, below that is the output from a PSDebug (may be helpful) and below that is my build run.

I noticed that AppCmd returned an error which got placed in the $sites variable and the $sites variable test (line97: 'if($sites.Length -gt 0) {' ) succeeds.

My log: PS C:\NuGetGallery\tools> .\Setup-DevEnvironment.ps1 [BEGIN] Setting up IIS Express URL reservation successfully added URL reservation successfully added WARNING: Site 'NuGet Gallery (localhost)' already exists. Deleting and recreating. ERROR ( message:Configuration error Filename: \?\C:\Users\Administrator\Documents\IISExpress\config\applicationHost.config Line Number: 0 Description: Cannot read configuration file . ) ERROR ( message:Configuration error Filename: \?\C:\Users\Administrator\Documents\IISExpress\config\applicationHost.config Line Number: 0 Description: Cannot read configuration file . ) [DONE] Setting up IIS Express [BEGIN] Setting SSL Certificate Generating a Self-Signed SSL Certificate for localhost Using SSL Certificate: 5BBCB2A4173A222A0005B6196F52C5921EB77636 SSL Certificate successfully added [DONE] Setting SSL Certificate [BEGIN] Running Migrations Updating Nuget Gallery database... Applying explicit migrations: [201110060711357_Initial, 201110102157002_PrereleaseChanges, 201110180052097_GallerySettings, 201110230649210_PackageOwn erRequests, 201111022024584_PackageDependencyVersionSpec, 201111022051010_PackageReleaseNotes, 201111080239544_ListPackagesIndexes, 201111080816426_Di splayPackageIndexes, 201111081908453_MyPackagesIndexes, 201111150729167_AddSmtpPassword, 201111222338036_GalleryOwnerEmailSettings, 201201031925005_Ad dPasswordHash, 201203180016174_CuratedFeeds, 201203180320147_ChangeCuratedFeedIdToName, 201203182132476_CuratedPackages, 201205172325056_FrameworkName , 201206131919241_AddTargetFxToDependencies, 201206250141447_ExecuteELMAHSql, 201208171904586_Language, 201208222206329_ColumnLengthOfPackageTable, 20 1208222227425_PackageIndexes, 201208230640333_PackageSortingIndexes, 201208302051344_CreateAggregateStatisticsSP, 201209181743161_AggregateStatsSp_Red uxLastUpdate, 201210312146585_GallerySettings_TotalDownloadCount, 201210312150156_AggregateStatistics_TotalDownloadCount, 201211271813001_AddNuGetOper at...]. Applying explicit migration: 201110060711357_Initial. Applying explicit migration: 201110102157002_PrereleaseChanges. Applying explicit migration: 201110180052097_GallerySettings. Applying explicit migration: 201110230649210_PackageOwnerRequests. Applying explicit migration: 201111022024584_PackageDependencyVersionSpec. WARNING: Caution: Changing any part of an object name could break scripts and stored procedures. Applying explicit migration: 201111022051010_PackageReleaseNotes. Applying explicit migration: 201111080239544_ListPackagesIndexes. Applying explicit migration: 201111080816426_DisplayPackageIndexes. Applying explicit migration: 201111081908453_MyPackagesIndexes. Applying explicit migration: 201111150729167_AddSmtpPassword. Applying explicit migration: 201111222338036_GalleryOwnerEmailSettings. Applying explicit migration: 201201031925005_AddPasswordHash. Applying explicit migration: 201203180016174_CuratedFeeds. Applying explicit migration: 201203180320147_ChangeCuratedFeedIdToName. Applying explicit migration: 201203182132476_CuratedPackages. Applying explicit migration: 201205172325056_FrameworkName. Applying explicit migration: 201206131919241_AddTargetFxToDependencies. Applying explicit migration: 201206250141447_ExecuteELMAHSql. Applying explicit migration: 201208171904586_Language. Applying explicit migration: 201208222206329_ColumnLengthOfPackageTable. Applying explicit migration: 201208222227425_PackageIndexes. Applying explicit migration: 201208230640333_PackageSortingIndexes. Applying explicit migration: 201208302051344_CreateAggregateStatisticsSP. Applying explicit migration: 201209181743161_AggregateStatsSp_ReduxLastUpdate. Applying explicit migration: 201210312146585_GallerySettings_TotalDownloadCount. Applying explicit migration: 201210312150156_AggregateStatistics_TotalDownloadCount. Applying explicit migration: 201211271813001_AddNuGetOperation. Applying explicit migration: 201301180132053_RemoveWorkItems. Applying explicit migration: 201302072118537_MovingGallerySettingsToConfiguration. Applying explicit migration: 201302282115583_AddMinRequiredVerisonColumn. Applying explicit migration: 201304020006512_UserLookupOptimization. Applying explicit migration: 201304091828587_Contract_UniqueCuratedPackages. Applying explicit migration: 201304251927587_UserCreatedDate. Applying explicit migration: 201306031734581_WidenStatisticsOperationColumn. Applying explicit migration: 201306031754328_SupportNewClientHeaders. Applying explicit migration: 201308051913351_EditableMetadata. Applying explicit migration: 201308292200027_PackageLastEditedTimestamp. Applying explicit migration: 201308302258388_AddPackageEditLastErrorColumn. Applying explicit migration: 201309092040124_LicenseReports. Applying explicit migration: 201309092041546_AddPackageLicenseReportSproc. Applying explicit migration: 201309101922464_NormalizedVersionColumn. Applying explicit migration: 201309172217450_CredentialsTable. Applying explicit migration: 201310281909048_PackageStatistics. Applying explicit migration: 201310301757446_RemoveOldCredentialColumns. Applying explicit migration: 201310301947399_AddCredentialDescriptionColumn. Applying explicit migration: 201311261928187_NullifyOldColumns. Applying explicit migration: 201505261416326_UniquePackageRegistration. Applying explicit migration: 201507171324501_AdditionalIndexesForPerformance. Applying explicit migration: 201508031046581_IndexPackagesLastUpdatedWithIsListed. Applying explicit migration: 201510010732458_EntityFramework6. Applying explicit migration: 201510011319560_PackageDelete. Applying explicit migration: 201511050008198_PackagesCreatedDateDefaultValue. Applying explicit migration: 201602181939424_RemovePackageStatistics. Applying explicit migration: 201603111230347_RemoveSqlDownloadStatsAggregation. Applying explicit migration: 201603151731262_AddIndexForPackageDeletes. Applying explicit migration: 201604061724388_NotifyPackagePushed. Applying explicit migration: 201605250728584_AddAdditionalIndexForPackageDeletes. Applying explicit migration: 201605250755294_AddIndexForUserEmailAddress. Applying explicit migration: 201605310704169_RemoveOldCredentialColumnsFromUsersTable. Applying explicit migration: 201606012049351_AddIndexForCredentialsUserKey. Applying explicit migration: 201606012058492_AddIndexForPackageLicenseReportsPackageKey. Applying explicit migration: 201606020741056_CredentialExpires. Applying explicit migration: 201607190813558_CredentialDoesNotExpire. Applying explicit migration: 201607190842411_CredentialLastUsed. Applying explicit migration: 201608251939567_AddPackageTypes. Applying explicit migration: 201609092252096_AddIndexCredentialExpires. Applying explicit migration: 201609092255576_AddIndexUsersEmail. Applying explicit migration: 201609211206577_ApiKeyDescription. Applying explicit migration: 201609260823310_ScopedCredential. Applying explicit migration: 201609270831462_AddExpirationColumn. Applying explicit migration: 201610042351343_AddUserFailedLogin. Applying explicit migration: 201611240011320_AddTriggerForPackagesLastEdited. Applying explicit migration: 201701120413341_AddScopeCredentialKey. Applying explicit migration: 201703221228170_AddSemVerLevelKeyColumn. Applying explicit migration: 201704191802404_AddIndexPackageRegistrationKeySemVer. Applying explicit migration: 201704211454424_SecurityPolicies. Applying explicit migration: 201705031714183_AddIndexSemVerLevelKey. Applying explicit migration: 201705032101231_SecurityPoliciesFix. Applying explicit migration: 201705041614287_UserSecurityPolicies_SubscriptionColumn. Applying explicit migration: 201706061829243_AddSemVer2LatestVersionColumns. Applying explicit migration: 201706080632469_AddIndexIsLatestSemVer2. Applying explicit migration: 201706080930506_AddIndexSemVerLevelKeyPackageRegistrationKey. Running Seed method. Updating Nuget Gallery Support request database... Applying explicit migrations: [201602111647053_SupportRequestDbModel, 201602191039005_PackageInfoIsOptional]. Applying explicit migration: 201602111647053_SupportRequestDbModel. Applying explicit migration: 201602191039005_PackageInfoIsOptional. Running Seed method. Update Complete! [DONE] Running Migrations


Debug output:

PS C:\NuGetGallery\tools> Set-PSBreakpoint -line 57 -script .\Setup-DevEnvironment.ps1

ID Script Line Command Variable Action


0 Setup-DevEnvironment.ps1 57

PS C:\NuGetGallery\tools> .\Setup-DevEnvironment.ps1 Entering debug mode. Use h or ? for help.

Hit Line breakpoint on 'C:\NuGetGallery\tools\Setup-DevEnvironment.ps1:57'

At C:\NuGetGallery\tools\Setup-DevEnvironment.ps1:57 char:1

[DBG]: PS C:\NuGetGallery\tools>> s At C:\NuGetGallery\tools\Setup-DevEnvironment.ps1:61 char:5

[DBG]: PS C:\NuGetGallery\tools>> s At C:\NuGetGallery\tools\Setup-DevEnvironment.ps1:66 char:1

[DBG]: PS C:\NuGetGallery\tools>> s At C:\NuGetGallery\tools\Setup-DevEnvironment.ps1:70 char:5

Name Property


10.0 InstallPath : C:\Program Files\IIS Express\ Manifest : iisexpress.exe.manifest NonAdminSSLLow : 44300 NonAdminSSLHigh : 44399

[DBG]: PS C:\NuGetGallery\tools>> s At C:\NuGetGallery\tools\Setup-DevEnvironment.ps1:71 char:17

[DBG]: PS C:\NuGetGallery\tools>> s At C:\NuGetGallery\tools\Setup-DevEnvironment.ps1:71 char:19

[DBG]: PS C:\NuGetGallery\tools>> s At C:\NuGetGallery\tools\Setup-DevEnvironment.ps1:77 char:5

[DBG]: PS C:\NuGetGallery\tools>> v At C:\NuGetGallery\tools\Setup-DevEnvironment.ps1:78 char:5

Filename: \?\C:\Users\Administrator\Documents\IISExpress\config\applicationHost.config

Line Number: 0

Description: Cannot read configuration file

. ) [DBG]: PS C:\NuGetGallery\tools>> C:\Program Files\IIS Express\appcmd.exe list site $siteFullName C:\Program : The term 'C:\Program' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

[DBG]: PS C:\NuGetGallery\tools>> 'C:\Program Files\IIS Express\appcmd.exe' list site $siteFullName At line:1 char:43

[DBG]: PS C:\NuGetGallery\tools>> 'C:\Program Files\IIS Express\appcmd.exe list site $siteFullName' C:\Program Files\IIS Express\appcmd.exe list site $siteFullName [DBG]: PS C:\NuGetGallery\tools>> "C:\Program Files\IIS Express\appcmd.exe" list site $siteFullName At line:1 char:43

[DBG]: PS C:\NuGetGallery\tools>> appcmd appcmd : The term 'appcmd' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

[DBG]: PS C:\NuGetGallery\tools>> s At C:\NuGetGallery\tools\Setup-DevEnvironment.ps1:96 char:12

Filename: \?\C:\Users\Administrator\Documents\IISExpress\config\applicationHost.config

Line Number: 0

Description: Cannot read configuration file

. ) [DBG]: PS C:\NuGetGallery\tools>> s At C:\NuGetGallery\tools\Setup-DevEnvironment.ps1:98 char:5

Filename: \?\C:\Users\Administrator\Documents\IISExpress\config\applicationHost.config

Line Number: 0

Description: Cannot read configuration file

. ) [DBG]: PS C:\NuGetGallery\tools>> &$AppCmdPath add site /name:"$SiteFullName" /bindings:"http://$(Get-SiteHttpHost),https://$(Get-SiteHttpsHost)" /phy sicalPath:$SitePhysicalPath ERROR ( message:Configuration error

Filename: \?\C:\Users\Administrator\Documents\IISExpress\config\applicationHost.config

Line Number: 0

Description: Cannot read configuration file

. ) [DBG]: PS C:\NuGetGallery\tools>> &$AppCmdPath add site /name:"$SiteFullName" /bindings:"http://$(Get-SiteHttpHost),https://$(Get-SiteHttpsHost)" /phy sicalPath:$SitePhysicalPath ERROR ( message:Configuration error

Filename: \?\C:\Users\Administrator\Documents\IISExpress\config\applicationHost.config

Line Number: 1

Description: Configuration file is not well-formed XML

. ) [DBG]: PS C:\NuGetGallery\tools>> &$AppCmdPath add site /name:"$SiteFullName" /bindings:"http://$(Get-SiteHttpHost),https://$(Get-SiteHttpsHost)" /phy sicalPath:$SitePhysicalPath SITE object "NuGet Gallery (localhost)" added APP object "NuGet Gallery (localhost)/" added VDIR object "NuGet Gallery (localhost)/" added [DBG]: PS C:\NuGetGallery\tools>> s [DONE] Setting up IIS Express At C:\NuGetGallery\tools\Setup-DevEnvironment.ps1:105 char:1


.\Build output:

PS C:\NuGetGallery> .\build

Directory: C:\NuGetGallery

Mode LastWriteTime Length Name


d----- 6/13/2017 2:52 PM build Downloading files from https://api.github.com/repos/NuGet/ServerCommon/contents/build?ref=37ff6e758c38b3f513af39f881399ce85f4ff20b Downloading file at https://raw.githubusercontent.com/NuGet/ServerCommon/37ff6e758c38b3f513af39f881399ce85f4ff20b/build/Queue-Build.ps1 Downloading file at https://raw.githubusercontent.com/NuGet/ServerCommon/37ff6e758c38b3f513af39f881399ce85f4ff20b/build/common.ps1 Downloading file at https://raw.githubusercontent.com/NuGet/ServerCommon/37ff6e758c38b3f513af39f881399ce85f4ff20b/build/init.ps1 Downloading file at https://raw.githubusercontent.com/NuGet/ServerCommon/37ff6e758c38b3f513af39f881399ce85f4ff20b/build/sign.targets Downloading files from https://api.github.com/repos/NuGet/ServerCommon/contents/tools?ref=37ff6e758c38b3f513af39f881399ce85f4ff20b

Directory: C:\NuGetGallery\tools

Mode LastWriteTime Length Name


d----- 6/13/2017 2:52 PM 7zip Downloading files from https://api.github.com/repos/NuGet/ServerCommon/contents/tools/7zip?ref=37ff6e758c38b3f513af39f881399ce85f4ff20b Downloading file at https://raw.githubusercontent.com/NuGet/ServerCommon/37ff6e758c38b3f513af39f881399ce85f4ff20b/tools/7zip/7-zip.chm Downloading file at https://raw.githubusercontent.com/NuGet/ServerCommon/37ff6e758c38b3f513af39f881399ce85f4ff20b/tools/7zip/7za.exe

[14:52:53 +0] ============================================================ [14:52:53 +0] Build #102707 started at 06/13/2017 18:52:53 [14:52:53 +0] [BEGIN] Getting private build tools [14:52:53 +0] No private build tools are configured. Use the 'PRIVATE_BUILD_TOOLS_REPO' and 'PRIVATE_BUILD_TOOLS_COMMIT' environment variables. [14:52:53 +0] [DONE +0:00] Getting private build tools [14:52:53 +0] [BEGIN] Cleaning test results [14:52:53 +0] Cleaning test results [14:52:53 +0] [DONE +0:00] Cleaning test results [14:52:53 +0] [BEGIN] Installing NuGet.exe [14:52:53 +0] Downloading VSTS credential provider [14:53:57 +64] Extracting VSTS credential provider

7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18

Processing archive: C:\NuGetGallery.nuget\CredentialProviderBundle.zip

Extracting CredentialProvider.VSS.exe Extracting NuGet.exe Extracting EULA_Microsoft Visual Studio Team Services Credential Provider.docx Extracting ThirdPartyNotices.txt

Everything is Ok

Files: 4 Size: 18412923 Compressed: 6401779 [14:53:59 +2] Downloading latest prerelease of nuget.exe [14:55:05 +66] [DONE +2:11] Installing NuGet.exe WARNING: [14:55:05 +0] [SKIP] Clearing package cache [14:55:05 +0] [BEGIN] Clearing artifacts

Directory: C:\NuGetGallery

Mode LastWriteTime Length Name


d----- 6/13/2017 2:55 PM artifacts [14:55:06 +0] [DONE +0:00] Clearing artifacts [14:55:06 +0] [BEGIN] Restoring solution packages [14:55:06 +0] Installing packages @"C:\NuGetGallery.nuget" [14:55:06 +0] C:\NuGetGallery.nuget\nuget.exe install C:\NuGetGallery.nuget\packages.config -verbosity quiet -NonInteractive -ExcludeVersion -Outp utDirectory C:\NuGetGallery\packages [14:56:30 +84] [DONE +1:24] Restoring solution packages [14:56:30 +0] [BEGIN] Set version metadata in AssemblyInfo.cs

Directory: C:\NuGetGallery\src\NuGetGallery\Properties

Mode LastWriteTime Length Name


-a---- 6/13/2017 2:56 PM 0 AssemblyInfo.g.cs [14:56:30 +0] Getting version info in @"C:\NuGetGallery\src\NuGetGallery\Properties\AssemblyInfo.g.cs" [14:56:30 +0] [assembly: AssemblyVersion("1.0.0")] [14:56:30 +0] [assembly: AssemblyInformationalVersion("1.0.0-master")] [14:56:30 +0] [assembly: AssemblyMetadata("Branch", "master")] [14:56:30 +0] [assembly: AssemblyMetadata("CommitId", "68e84b6")] [14:56:30 +0] [assembly: AssemblyMetadata("BuildDateUtc", "06/13/2017 18:56:30 +00:00")]

Directory: C:\NuGetGallery\src\NuGetGallery.Core\Properties

Mode LastWriteTime Length Name


-a---- 6/13/2017 2:56 PM 0 AssemblyInfo.g.cs [14:56:30 +0] Getting version info in @"C:\NuGetGallery\src\NuGetGallery.Core\Properties\AssemblyInfo.g.cs" [14:56:30 +0] [assembly: AssemblyVersion("1.0.0")] [14:56:30 +0] [assembly: AssemblyInformationalVersion("1.0.0-master")] [14:56:30 +0] [assembly: AssemblyMetadata("Branch", "master")] [14:56:30 +0] [assembly: AssemblyMetadata("CommitId", "68e84b6")] [14:56:30 +0] [assembly: AssemblyMetadata("BuildDateUtc", "06/13/2017 18:56:30 +00:00")] [14:56:31 +0] [DONE +0:00] Set version metadata in AssemblyInfo.cs [14:56:31 +0] [BEGIN] Building solution [14:56:32 +1] Installing and configuring NuGet.Services.Build [14:56:37 +6] MSBuild found at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin\msbuild.exe [14:56:37 +0] Restoring packages @"C:\NuGetGallery" [14:56:37 +0] C:\NuGetGallery.nuget\nuget.exe restore C:\NuGetGallery\NuGetGallery.sln -MSBuildPath C:\Program Files (x86)\Microsoft Visual Studio\ 2017\Community\MSBuild\15.0\bin -verbosity quiet [14:57:31 +53] MSBuild found at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin\msbuild.exe [14:57:31 +0] C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin\msbuild.exe C:\NuGetGallery\NuGetGallery.sln /p:Configu ration=debug;BuildNumber=102707 /verbosity:minimal /p:MvcBuildViews=true Microsoft (R) Build Engine version 15.1.1012.6693 Copyright (C) Microsoft Corporation. All rights reserved.

NuGet.Services.Search.Client -> C:\NuGetGallery\src\NuGet.Services.Search.Client\bin\Debug\NuGet.Services.Search.Client.dll NuGetGallery.Core -> C:\NuGetGallery\src\NuGetGallery.Core\bin\Debug\NuGetGallery.Core.dll NuGetGallery -> C:\NuGetGallery\src\NuGetGallery\bin\NuGetGallery.dll NuGetGallery.Core.Facts -> C:\NuGetGallery\tests\NuGetGallery.Core.Facts\bin\Debug\NuGetGallery.Core.Facts.dll Consider app.config remapping of assembly "Microsoft.ApplicationInsights, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "2.1.0.0" [] to Version "2.2.0.0" [C:\NuGetGallery\packages\Microsoft.ApplicationInsights.2.2.0\lib\net46\Microsoft.ApplicationInsights.dll] to solve conflic t and get rid of warning. C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3247: Foun d conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: [C:\NuGetGallery\tests\NuG etGallery.Facts\NuGetGallery.Facts.csproj] NuGetGallery.Facts -> C:\NuGetGallery\tests\NuGetGallery.Facts\bin\Debug\NuGetGallery.Facts.dll [14:59:34 +123] [DONE +3:02] Building solution [14:59:34 +0] [BEGIN] Creating artifacts [14:59:34 +0] Creating package from @"C:\NuGetGallery\src\NuGetGallery.Core\NuGetGallery.Core.csproj" [14:59:34 +1] MSBuild found at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin\msbuild.exe [14:59:34 +0] C:\NuGetGallery.nuget\nuget.exe pack C:\NuGetGallery\src\NuGetGallery.Core\NuGetGallery.Core.csproj -OutputDirectory C:\NuGetGallery\ artifacts\ -Properties Configuration=debug -MSBuildPath C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin -Version 1.0.0- zlocal -Symbols Using Msbuild from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin'. Attempting to build package from 'NuGetGallery.Core.csproj'. Packing files from 'C:\NuGetGallery\src\NuGetGallery.Core\bin\Debug'. Using 'NuGetGallery.Core.nuspec' for metadata. Found packages.config. Using packages listed as dependencies Successfully created package 'C:\NuGetGallery\artifacts\NuGetGallery.Core.1.0.0-zlocal.nupkg'.

Attempting to build symbols package for 'NuGetGallery.Core.csproj'. Packing files from 'C:\NuGetGallery\src\NuGetGallery.Core\bin\Debug'. Using 'NuGetGallery.Core.nuspec' for metadata. Found packages.config. Using packages listed as dependencies Successfully created package 'C:\NuGetGallery\artifacts\NuGetGallery.Core.1.0.0-zlocal.symbols.nupkg'. [14:59:39 +4] [DONE +0:04] Creating artifacts [14:59:39 +0] ------------------------------------------------------------ [14:59:39 +0] Build #102707 ended at 06/13/2017 18:59:39 [14:59:39 +0] Time elapsed 7:45 [14:59:39 +0] ============================================================

joelverhagen commented 7 years ago

/cc @loic-sharma