Preserve dynamically-created static content between redeploys?

已答复 Preserve dynamically-created static content between redeploys?

  • 2012年3月6日 18:35
     
     
    So I have an Azure site that has a reporting area, which generates images on the fly as the user needs them, and saves them to be accessed via emails that are automatically sent out by the system. We had to link the images instead of attach them due to email security reasons. Unfortunately, the entire site folder is deleted when I redeploy the application. Is there any way to avoid this problem, while keeping the generated images publicly accessible via a URL?

全部回复

  • 2012年3月6日 18:56
     
     建议的答复

    Hi,

    General recommendation would be to store these images in blob storage instead of storing these images in the VM itself as Windows Azure VM is not a persistent storage.

    Hope this helps.

    Thanks

    Gaurav Mantri

    Cerebrata Software

    http://www.cerebrata.com

    • 已建议为答案 Vitor Tomaz 2012年3月6日 18:58
    •  
  • 2012年3月6日 19:03
     
     建议的答复

    Hi,

    Adding @Gaurav Mantri answer:

    Putting images at blob storage is a good approach also because you can retrieve the image directly from blob storage, that option can add performance because roles are not in the way anymore and are free to answer another kind of requests.


    If you found this post useful, Please "Mark as Answer" or "Vote as Helpful". Best Regards.

    • 已建议为答案 Vitor Tomaz 2012年3月6日 19:03
    •  
  • 2012年3月6日 19:25
     
     

    Depending on your needs, another option is, in addition to or instead of blob storage,  used to the Azure cache service.

    Edited.
    Gaurav, You are correct. I actual meant CDN.

    • 已编辑 Lucifure 2012年3月6日 20:52
    •  
  • 2012年3月6日 19:42
     
     

    Depending on your needs, another option is, in addition to or instead of blob storage,  used to the Azure cache service.


    I'm not sure how caching service can be used in this scenario. Can you please explain? Plus, it could become very expensive as well based on the pricing available here: http://www.windowsazure.com/en-us/home/features/caching/

    Thanks

    Gaurav

  • 2012年3月6日 19:43
     
      包含代码

    Alright, I'm working down this blob path, and it's all fine and well, except for this:

    CS0234: The type or namespace name 'ServiceRuntime' does not exist in the namespace 'Microsoft.WindowsAzure' (are you missing an assembly reference?)

    The line in question:

    using Microsoft.WindowsAzure.ServiceRuntime;

    Upon Googling, the common answer seems to be "set the target framework to 4 rather than 4 Client Profile", but I don't have that option... all I have is 4. The references are most certainly there for the ServiceRuntime namespace, and I don't see Microsoft.WindowsAzure as a reference I can add, so.. I'm clueless. Any ideas?

    Also, this WYSIWYG editor sucks.. very unpredictable. Not good UI.

  • 2012年3月7日 9:34
    版主
     
     

    Hi,

    As far as i know, if you install Azure SDK (for example, SDK 1.6) and create a Cloud application (with Web Role), the Windows Azure References were added automatically (Microsoft.WindowsAzure.Diagnostics, Microsoft.WindowsAzure.ServiceRuntime, Microsoft.WindowsAzure.StorageClient). Does your application is web role application, if not please try to create a new web application to see if it works. The solution in Google "set the target framework to 4 rather than 4 Client Profile" because of if you create a Windows Console application via VS, the default target framework is 4 Client Profile, and if you want to use Azure assemblies, you need change it to 4.

    Hope it can help you.


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework


  • 2012年3月9日 21:52
     
     已答复

    I've double-checked everything, and I can't see anything wrong. The project is a Role project, all the references are there, even VS recognizes all the namespaces and doesn't have any problems with the code. It's only when I try to run it that it starts freaking out about the Microsoft.WindowsAzure.ServiceRuntime namespace. However, I do believe I just found my way around the issue, by storing the StorageConnectionString in the web.config rather than service config, so I was able to remove that namespace from the code itself. Hopefully this works as advertised...

    Thanks for the help, and for clearing up the Client Profile confusion.