1

I am trying to save an image in an azure worker roles' file system.

This is my code :

BlobStream inputImage = inputBlob.OpenRead();
Stream inputStream = inputImage;
    string inputPath = "F:\\approot\\input\\" + imageId; //Image id is 582

    inputStream.Position = 0;
                    //save image to physicall file
                    var img = Image.FromStream(inputStream);
                    string imagePath = pInputPath + "\\" + pImageId + ".png";
                    img.Save(imagePath, ImageFormat.Png);
                    var xml = "";

This problem came all of the sudden, my application was working but suddenly it started crashing at this point.

4

1 回答 1

0

我猜是f盘的问题。您会偶尔发现这一点,e:并且f:可能会在重新启动后发生变化。由于您声称事情正常,然后突然开始崩溃,我在想,如果您 rdp 进入您的角色实例,您会发现approotnow one:而不是f:.

应该有一个环境变量 ,RoleRoot您可以使用它来确定您所在的驱动器approot

Environment.GetEnvironmentVariable("RoleRoot");
于 2013-07-12T15:23:52.600 回答