Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6693999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:03:04+00:00 2026-05-26T06:03:04+00:00

I have a portion of code for uploading text to Azure blob storage. It

  • 0

I have a portion of code for uploading text to Azure blob storage. It uses CloudBlobClient.GetContainerReference().GetBlobReference().UploadText().

string connectionString = RoleEnvironment.GetConfigurationSettingValue( "StorageConnectionString" );
CloudStorageAccount account = CloudStorageAccount.Parse( connectionString );
CloudBlobClient blobClient = account.CreateCloudBlobClient();
CloudBlobContainer container = client.GetContainerReference( containerName );
container.CreateIfNotExist();
DateTime currentTime = DateTime.UtcNow;
String instanceId = RoleEnvironment.CurrentRoleInstance.Id;
int threadId = System.Threading.Thread.CurrentThread.ManagedThreadId;
String blobPath = String.Format( "error-{0}-{1}-{2}", currentTime.Ticks, instanceId, threadId );
container.GetBlobReference( blobPath ).UploadText( textToUpload );

So far the code worked okay. Now I add invokation of that code into various places of an ASP.NET MVC2 application to debug the latter and the code silently does nothing – no exceptions, no new blobs, no anything. If I try to obtain

String justUploaded = container.GetBlobReference( blobPath ).DownloadText( textToUpload );

right after that and post the result on a web page – there’s no exception again and the string is empty. If I try to obtain

String uri = container.GetBlobReference( blobPath ).Uri.ToString();

again there’s no exception and the string is empty.

The very same upload code works okay from inside OnStart() of the same web role that contains the MVC application.

What’s the likely reason for writing to blobs storage not working? How do I resolve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:03:04+00:00Added an answer on May 26, 2026 at 6:03 am

    Okay, problem resolved. Now a bit of Toyota Five Whys.

    Q Why would text not be uploaded to blob storage?
    A It wouldn’t because the code above was not invoked.

    Q Why was that code not invoked?
    A It wasn’t because its invokation was dependent on loose coupling code that was using Reflection to detect whether Microsoft.WindowsAzure.ServiceRuntime was loaded into current application domain. The assembly was not loaded, so the code would not even try to access blob storage and would fall back into “I’m not on Azure” mode.

    Q WTF??? Haven’t you tested that code earlier?
    A I have tested it, but not in MVC app and looks like behavior is different in MVC app compared to not in MVC app. The assembly was loaded in the configuration I was testing earlier.

    Q How to force loading the assembly?
    A Not sure, but looks like adding it under <system.web><compilation><assemblies> solves the problem. Here’s a question specifically about that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With ASP .NET MVC3. In my controller I have this portion of code MasterMindDnetEntities
Let's say we have a code portion like this: IProduct product = ProductCreator.CreateProduct(); //Factory
In my mvc3 POST ActionResult method, I have a portion of code like this:
I'm reading some code of a model malloc (allocateMemory). I have posted a portion
I have some portion of code that needs to be executed in each thread
this portion of code is outputing 01/01/1970. is my code incorrect? i have only
I have a portion of HTML code in R like the one below: </a>
I have a portion of code like this: Process proc = null; try {
I have a portion of code that is dynamically loaded via an AJAX call
I have this portion of code: var hasAttribute = TypeDescriptor.GetAttributes(property.DeclaringType).OfType<CrmTypeAttribute>() .Any((attr) => ((CrmTypeAttribute)attr).Name ==

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.