Service Fabric应用程序升级失败。 FileLoadException

时间:2019-10-14 08:18:04

标签: c# azure azure-service-fabric

我正在尝试使用Visual Studio 2019从Microsoft升级示例应用程序(投票)。 在更新期间,出现以下错误:

4>FABRIC_E_IMAGEBUILDER_UNEXPECTED_ERROR: One or more errors occurred. --> AggregateException: One or more errors occurred. --> FileLoadException: The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
4>Registration of application type failed.
4>At C:\Program Files\Microsoft SDKs\Service Fabric\Tools\PSModule\ServiceFabricSDK\Publish-UpgradedServiceFabricApplication.ps1:258 char:17
4>+                 throw "Registration of application type failed."
4>+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4>    + CategoryInfo          : OperationStopped: (Registration of application type failed.:String) [], RuntimeException
4>    + FullyQualifiedErrorId : Registration of application type failed.

完整的输出是:

1>------ Build started: Project: VotingWeb, Configuration: Debug Any CPU ------
2>------ Build started: Project: VotingData, Configuration: Debug Any CPU ------
2>Waiting for output folder cleanup...
1>Waiting for output folder cleanup...
1>Output folder cleanup has been completed.
2>Output folder cleanup has been completed.
1>VotingWeb -> C:\DEV\Teamcity test\service-fabric-sample-app\VotingWeb\bin\Debug\net472\win7-x64\VotingWeb.exe
2>VotingData -> C:\DEV\Teamcity test\service-fabric-sample-app\VotingData\bin\Debug\net472\win7-x64\VotingData.exe
3>------ Build started: Project: Voting, Configuration: Debug x64 ------
4>------ Publish started: Project: Voting, Configuration: Debug x64 ------
4>Started executing script 'GetApplicationExistence'.
4>Finished executing script 'GetApplicationExistence'.
4>Time elapsed: 00:00:02.7466922
-------- Package started: Project: Voting, Configuration: Debug x64 ------
Das Verzeichnis ist nicht leer.
VotingData -> C:\DEV\Teamcity test\service-fabric-sample-app\VotingData\bin\Debug\net472\win7-x64\VotingData.exe
VotingData -> C:\DEV\Teamcity test\service-fabric-sample-app\VotingData\obj\Debug\net472\win7-x64\PubTmp\Out\
VotingWeb -> C:\DEV\Teamcity test\service-fabric-sample-app\VotingWeb\bin\Debug\net472\win7-x64\VotingWeb.exe
VotingWeb -> C:\DEV\Teamcity test\service-fabric-sample-app\VotingWeb\obj\Debug\net472\win7-x64\PubTmp\Out\
Voting -> C:\DEV\Teamcity test\service-fabric-sample-app\Voting\pkg\Debug
-------- Package: Project: Voting succeeded, Time elapsed: 00:00:34.0353563 --------
4>Started executing script 'Deploy-FabricApplication.ps1'.
4>powershell -NonInteractive -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command ". 'C:\DEV\Teamcity test\service-fabric-sample-app\Voting\Scripts\Deploy-FabricApplication.ps1' -ApplicationPackagePath 'C:\DEV\Teamcity test\service-fabric-sample-app\Voting\pkg\Debug' -PublishProfileFile 'C:\DEV\Teamcity test\service-fabric-sample-app\Voting\PublishProfiles\Cloud.xml' -DeployOnly:$false -ApplicationParameter:@{} -UnregisterUnusedApplicationVersionsAfterUpgrade $false -OverrideUpgradeBehavior 'None' -OverwriteBehavior 'SameAppTypeAndVersion' -SkipPackageValidation:$false -ErrorAction Stop"
4>Application Type  VotingType  and Version  1.7.2  was already registered with Cluster, unregistering it...
4>Unregister application type succeeded.
4>Copying application package to image store...
4>Upload to Image Store succeeded
4>Registering application type...
4>Register application type started. Use Get-ServiceFabricApplicationType to query for status.
4>Running Image Builder process ...
4>Downloading application package from 'VotingType' ...
4>Downloaded 101/999 Files (10.1% complete)
4>Downloaded 229/999 Files (22.9% complete)
4>Downloaded 291/999 Files (29.1% complete)
4>Downloaded 363/999 Files (36.3% complete)
4>Downloaded 447/999 Files (44.7% complete)
4>Downloaded 559/999 Files (56.0% complete)
4>Validating package and computing checksums ...
4>FABRIC_E_IMAGEBUILDER_UNEXPECTED_ERROR: One or more errors occurred. --> AggregateException: One or more errors occurred. --> FileLoadException: The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
4>Registration of application type failed.
4>At C:\Program Files\Microsoft SDKs\Service Fabric\Tools\PSModule\ServiceFabricSDK\Publish-UpgradedServiceFabricApplication.ps1:258 char:17
4>+                 throw "Registration of application type failed."
4>+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4>    + CategoryInfo          : OperationStopped: (Registration of application type failed.:String) [], RuntimeException
4>    + FullyQualifiedErrorId : Registration of application type failed.
4> 
4>Finished executing script 'Deploy-FabricApplication.ps1'.
4>Time elapsed: 00:01:44.9589058
4>The PowerShell script failed to execute.
========== Build: 3 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

如何找出正在使用的文件?

该如何解决?

解决方案:

如果其他人遇到相同的问题,对我来说,解决方案是使用Powershell升级应用程序,并在Copy-ServiceFabricApplicationPackage命令中设置CompressPackage参数。 有用的链接:https://docs.microsoft.com/de-de/azure/service-fabric/service-fabric-package-apps

0 个答案:

没有答案