none
High Bills in download when I am only uploading! RRS feed

  • Question

  • I was using Azure Storage to UPLOAD log files ... however I realized I got a hefty DOWNLOAD bill.  Here is my upload code... am i doing something wrong?

    /// <summary>

            /// Azures the upload file.

            /// </summary>

            /// <param name="addtimestamp">if set to <c>true</c> [addtimestamp].</param>

            /// <param name="AzureConnectionString">The azure connection string.</param>

            /// <param name="AzureContainer">The azure container.</param>

            /// <param name="filePath">The file path.</param>

            /// <param name="folderStrucutre">The folder strucutre.</param>

            /// <param name="maxStorageContainerInMB">The maximum storage container in mb.</param>

            /// <param name="maxStorageAttachmentInMB">The maximum storage attachment in mb.</param>

            /// <returns></returns>

            public static string AzureUploadFile(bool addtimestamp, string AzureConnectionString, string AzureContainer,

                string filePath, string folderStrucutre, float maxStorageContainerInMB, float maxStorageAttachmentInMB)

            {

                string connString = AzureConnectionString;

                string localFolder = filePath;

                string destContainer = AzureContainer.ToLower();

     

                CloudStorageAccount sa = CloudStorageAccount.Parse(connString);

                CloudBlobClient bc = sa.CreateCloudBlobClient();

     

                CloudBlobContainer container = bc.GetContainerReference(destContainer);

                if (maxStorageContainerInMB != -1)

                {

                    double spaceUsed = AzureGetSpaceUsed(AzureConnectionString, destContainer);

                    if (maxStorageContainerInMB != -1 && FormatBytesToMB(File.Open(filePath, FileMode.Open).Length) + spaceUsed > maxStorageContainerInMB)

                    {

                        return "Fail:Space Allocated Exceeded Amount Establised";

                    }

                }

                if (maxStorageAttachmentInMB != -1)

                {

                    if (maxStorageAttachmentInMB != -1 && FormatBytesToMB(File.Open(filePath, FileMode.Open).Length) > maxStorageAttachmentInMB)

                    {

                        return "Fail: File bigger then the proposed file limit";

                    }

                }

     

                if (container.CreateIfNotExists())

                {

                    // Explicitly configure container for private access

                    var permissions = container.GetPermissions();

                    permissions.PublicAccess = BlobContainerPublicAccessType.Off;

                    container.SetPermissions(permissions);

                }

     

                string key = Path.GetFileName(filePath);

                if (addtimestamp)

                {

                    key = GetTimestamp(DateTime.Now) + "-" + Path.GetFileName(filePath);

                }

                CloudBlockBlob b = container.GetBlockBlobReference(folderStrucutre + key);

                using (var fs = System.IO.File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.None))

                {

                    b = container.GetBlockBlobReference(folderStrucutre + key);

                    b.Properties.ContentType = FileGetContentType(Path.GetExtension(filePath));

                    b.UploadFromStream(fs);

                }

                return key;

            }



    Evan Camilleri http://www.holisticrd.com http://www.dotnetmushroom.com http://www.mobilesalesman.com

    • Moved by Md Shihab Tuesday, August 15, 2017 6:24 AM Better suited in Pricing & Billing
    Monday, August 14, 2017 8:02 AM

All replies

  • Hi,

    every read action will be considered as egress bandwhith.


    Cheers Christophe - Kindly click Mark as Answer on the post that helps you - www.cloudcrusader.com

    Monday, August 14, 2017 9:09 AM
  • I am not reading.  I am only uploading through this!!

    Evan Camilleri http://www.holisticrd.com http://www.dotnetmushroom.com http://www.mobilesalesman.com

    Monday, August 14, 2017 10:22 AM
  • Your code looks fine to me.  There is some reads to get the container information but not much.  I would check the logs to see if perhaps something else is going on.

    Gary A. Bushey

    Monday, August 14, 2017 10:53 AM
  • from where i can download the logs?

    Evan Camilleri http://www.holisticrd.com http://www.dotnetmushroom.com http://www.mobilesalesman.com

    Monday, August 14, 2017 1:50 PM
  • You can click in the individual databases in the portal and then "Activity Log" or do the same thing for the database server itself.

    Gary A. Bushey

    Monday, August 14, 2017 8:06 PM
  • Better still, I suggest you create a free billing support ticket to get detailed information on where the costs are coming from.

    -----------------------------------------------------------------------------------------------------

    Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.

    • Proposed as answer by Md Shihab Tuesday, August 15, 2017 6:16 AM
    Tuesday, August 15, 2017 6:16 AM
  • Please create a free ticket with MS Azure support and they can give the correct explanation of the charge incurred.
    Tuesday, August 15, 2017 6:24 AM