Azure cspack.exe throws System.Runtime.Remoting.RemotingException

418 views Asked by At

I have installed Azure SDK 2.5. When I run command:

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

I got an exception:

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)

At the same time this package is built successfully on other machines.

Does anybody face with this issue?

2

There are 2 answers

3
Wayne Kuo On

This was a bug that was introduced in SDK 2.5 for a long running CSPack process. There is a fix for this in the upcoming 2.6 release.

1
Benny Lam On

In our case it happens only on one machine (Win Server 2008R2) that we are using for automatic deployment to our testing environment, we are fine with using the CSPack workaround.

The workaround consists of two steps:

  1. MSBuild which fails, however it fails in last step of creating the package, so all the files that should be packed to the package are in folder "AzureProject\obj\Release\WebRoleName".
  2. Run CSPack manually:

    $releaseWebAppPath = "$tempPath\AzureProject\obj\Release\WebRoleName"
    & $cspackPath "$slnRootPath\AzureProject\ServiceDefinition.csdef" /role:"WebRoleName;$releaseWebAppPath" /sitePhysicalDirectories:"WebRoleName;Web;$releaseWebAppPath" /out:"$packagePath"
    

This creates a package that you should be able to deploy.