Azure cspack.exe抛出System.Runtime.Remoting.RemotingException

时间:2015-02-17 10:47:01

标签: azure remoting azure-sdk-.net cspack

我已经安装了Azure SDK 2.5。当我运行命令时:

"C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.5\bin\cspack.exe" .\ServiceDefinition.csdef "/out:Package.cspkg" 

我有一个例外:

Unhandled Exception: System.Runtime.Remoting.RemotingException: Object '/8ba37d11_3239_4c7c_9f1a_aa967b1dc5e9/eocq0iwbskmwhdjkfth7xtqy_4.rem' has been disconnected or does not exist at the server.
at System.IO.FileStream.get_CanRead()
at MS.Internal.IO.Zip.ZipIOLocalFileBlock.CheckFileAccessParameter(Stream stream, FileAccess access)
at MS.Internal.IO.Zip.ZipIOLocalFileBlock.GetStream(FileMode mode, FileAccess access)
at System.IO.Packaging.ZipPackagePart.GetStreamCore(FileMode mode, FileAccess access)
at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
at Microsoft.ServiceHosting.Tools.Packaging.Utils.CopyFullStreamToPart(Stream source, PackagePart part, PackageManifest manifest)
at Microsoft.ServiceHosting.Tools.Packaging.PackageCreator.CreateRolePackages(ModelProcessor modelProcessor, PackageManifest applicationManifest, Package applicationPackage)
at Microsoft.ServiceHosting.Tools.Packaging.PackageCreator.CreatePackage(Stream outputStream, Action`1 postProcess, PackageRestrictions restrictions)
at Microsoft.ServiceHosting.Tools.Packaging.ServiceApplicationPackage.CreateServiceApplicationPackage(String serviceModelFileName, String serviceDescriptionFile, Stream output, IPackageSecurity encrypt, Dictionary`2 namedStreamCollection, String userInfo, EventHandler`1 rolePackagePartAddedHandler)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.PackageCreator.CreateServiceApplicationPackage(String serviceRdFilePath, String processedServiceDefinitionFile, FileStream packageStream, Dictionary`2 namedStreams, Dictionary`2 rolesDictionary)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.PackageCreator.CreateServiceApplicationPackage(String serviceRdFilePath, String processedServiceDefinitionFile, FileStream packageStream, Dictionary`2 namedStreams, Dictionary`2 rolesDictionary)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.CSPack.TryCreatePackage(ServiceDefinitionModel sm)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.CSPack.Execute()
at Microsoft.ServiceHosting.Tools.Packaging.Program.Main(String[] args)

同时这个包在其他机器上成功构建。

有人面对这个问题吗?

2 个答案:

答案 0 :(得分:0)

这是SDK 2.5中为长时间运行的CSPack进程引入的错误。在即将发布的2.6版本中有一个解决方案。

答案 1 :(得分:0)

在我们的例子中,它只发生在我们用于自动部署到我们的测试环境的一台机器(Win Server 2008R2)上,我们可以使用CSPack解决方法。

解决方法包括两个步骤:

  1. MSBuild失败,但在创建包的最后一步失败,因此应该打包到包的所有文件都在文件夹" AzureProject \ obj \ Release \ WebRoleName"。
  2. 手动运行CSPack:

    $releaseWebAppPath = "$tempPath\AzureProject\obj\Release\WebRoleName"
    & $cspackPath "$slnRootPath\AzureProject\ServiceDefinition.csdef" /role:"WebRoleName;$releaseWebAppPath" /sitePhysicalDirectories:"WebRoleName;Web;$releaseWebAppPath" /out:"$packagePath"
    
  3. 这会创建一个您应该能够部署的包。