visual-studio - 服务结构本地集群设置错误

标签 visual-studio azure-service-fabric

按照下面的链接设置和运行本地集群。

https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-create-your-first-application-in-visual-studio

目前,在运行应用程序时,它会在设置本地集群时出错。

开发环境:
视窗 10,
Visual Studio 2017 试用版,
Docker for Windows(虽然没有使用)

PowerShell 脚本执行已启用,visual studio 以管理员身份运行。

错误消息:PowerShell 脚本执行失败。有关详细信息,请参阅输出窗口。

输出窗口:

1>------ Build started: Project: MyApplication, Configuration: Debug x64 ------
2>------ Deploy started: Project: MyApplication, Configuration: Debug x64 ------
2>Started executing script 'GetApplicationExistence'.
2>Finished executing script 'GetApplicationExistence'.
2>Time elapsed: 00:00:02.1304224
2>Started executing script 'Set-LocalClusterReady'.
2>powershell -NonInteractive -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command "Import-Module 'C:\Program Files\Microsoft SDKs\Service Fabric\Tools\Scripts\DefaultLocalClusterSetup.psm1'; Set-LocalClusterReady -createOneNodeCluster $true"
2>--------------------------------------------
2>Local Service Fabric Cluster is not setup...
2>Please wait while we setup the Local Service Fabric Cluster. This may take few minutes...
2>Stop-Service : Cannot find any service with service name 'FabricHostSvc'.
2>At C:\Program Files\Microsoft SDKs\Service Fabric\Tools\Scripts\ClusterSetupUtilities.psm1:144 char:5
2>+ Stop-Service FabricHostSvc -WarningAction SilentlyContinue
2>+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2> + CategoryInfo : ObjectNotFound: (FabricHostSvc:String) [Stop-Service], ServiceCommandException
2> + FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.StopServiceCommand
2>
2>WARNING: System.Management.Automation.CommandNotFoundException: The term 'Remove-ServiceFabricNodeConfiguration' is not
2> recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if
2>a path was included, verify that the path is correct and try again.
2>
2> at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception
2>exception)
2>
2> at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
2>
2> at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2>
2> at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2>WARNING: Remove-ServiceFabricNodeConfiguration throws exceptions
2>
2>Using Cluster Data Root: C:\SfDevCluster\Data
2>Using Cluster Log Root: C:\SfDevCluster\Log
2>
2>The generated json path is C:\Users[username]\AppData\Local\Temp\tmp5D74.tmp.json
2>Processing and validating cluster config.
2>Failed to open base key for machine ComputerFullName to check if machine is IOT Core.
2>Test-ServiceFabricClusterManifest : The term 'Test-ServiceFabricClusterManifest' is not recognized as the name of a
2>cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
2>that the path is correct and try again.
2>At C:\Program Files\Microsoft SDKs\Service Fabric\Tools\Scripts\ClusterSetupUtilities.psm1:504 char:5
2>+ Test-ServiceFabricClusterManifest -ClusterManifestPath "$manifest ...
2>+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2> + CategoryInfo : ObjectNotFound: (Test-ServiceFabricClusterManifest:String) [], CommandNotFoundException
2> + FullyQualifiedErrorId : CommandNotFoundException
2>
2>PrepareClusterManifest : Could not validate cluster manifest
2>'C:\Users[username]\AppData\Local\Temp\LAP000338-Server-ScaleMin.xml'
2>At C:\Program Files\Microsoft SDKs\Service Fabric\Tools\Scripts\ClusterSetupUtilities.psm1:530 char:21
2>+ ... ifestFile = PrepareClusterManifest $manifestFileTemplate $imageStoreC ...
2>+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2> + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
2> + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,PrepareClusterManifest
2>
2>ScriptHalted
2>At C:\Program Files\Microsoft SDKs\Service Fabric\Tools\Scripts\ClusterSetupUtilities.psm1:508 char:9
2>+ throw
2>+ ~~~~~
2> + CategoryInfo : OperationStopped: (:) [], RuntimeException
2> + FullyQualifiedErrorId : ScriptHalted
2>
2>Finished executing script 'Set-LocalClusterReady'.
2>Time elapsed: 00:00:10.9335415
2>The PowerShell script failed to execute.
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

最佳答案

首先切入正题,这是安装程序的问题。
当我安装 Service Fabric SDK 时,安装过程中发生了一些事情,假设网络错误或安装未完成,但我不知何故错过了它,人为错误。

我不确定我是如何错过它的,但重点是,我尝试卸载并重新安装 SDK 几次,以确保 SDK 已完全安装。问题是,最初的不正确安装在整个过程中一直挥之不去,因为卸载时没有完全删除目录和文件,例如注册表项。

在我手动删除注册表项和目录并重新安装 SDK 之后,现在一切看起来都很好。

为了帮助任何有类似问题的人,编辑了下面的说明。
( https://github.com/Azure/service-fabric-issues/issues/566 ) 中的说明原文

1. Uninstall Microsoft Service Fabric SDK.
2. Uninstall Service Fabric tools using the Visual Studio Installer.
3. Delete folder: C:\Program Files\Microsoft Service Fabric
4. Delete folder from registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Service Fabric
5. Reboot PC
6. Download Microsoft Web PI (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-get-started) install the Microsoft Azure Service Fabric SDK. Btw. after I've deleted registry entries of SF, I've noticed that Web PI has finally installed three needed components (not only Azure Service Fabric SDK as it was for previous re-installations):
  Microsoft Visual C++ 2012 SP1 Redistributable Package (x64)
  Microsoft Azure Service Fabric Runtime - 6.3.162
  Microsoft Azure Service Fabric SDK - 3.2.162

7. Install Service Fabric tools using the Visual Studio Installer.
8. Create test project in Visual Studio 2017 and run it. Visual Studio created cluster automatically.

附言按照步骤操作后,如果仍然无法安装 Azure Service Fabric Runtime,它可能保留在“添加或删除程序”列表中,然后手动删除注册表项:Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ServiceFabric(或者是带有空间的“Service Fabric”......?)

关于visual-studio - 服务结构本地集群设置错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52012157/

相关文章:

c# - 如何在 Enterprise Architect 的标记值窗口中禁用删除选项

c++ - Visual Studio 不显示符号表?

visual-studio - 如何在 Visual Studio 的 AnkhSVN 中设置用户名/密码以连接到 Subversion 存储库?

azure-service-fabric - 服务结构 : need faster local deployment for development

azure - Service Fabric 应用程序 vmImageSku

c# - Reliable Collections 可以在 Service Fabric 之外使用吗?

android - 是否可以 Root Visual Studio Emulator Android?

visual-studio - 为什么 Visual Studio 在调试时会启动多个 WebDev?

docker - HTTPs 在带有 Docker 容器的 Service Fabric 中不起作用

asp.net-mvc - Service fabric 上的 https 请求返回 "Can’ t 安全连接到此页面”