Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Load XML file from devstoreaccount usinig CMS.AzureHelper View modes: 
User avatar
Member
Member
Punt - 12/20/2011 8:21:32 AM
   
Load XML file from devstoreaccount usinig CMS.AzureHelper
When I try to load a xml file from the local devstoreaccount an exception is thrown on BlobInfoProvider.GetBlobContent(bi);

BlobInfo object is there, but the GetBlobContent thows an NullReferenceException. We would like to put this functionallity in a helper class.

string path = "/bestellingen/298015264.xml";
// Get file content from blob
BlobInfo bi = new BlobInfo(path);

// Check if blob exists
if (BlobInfoProvider.BlobExists(bi))
{
BlobInfoProvider.InitBlobInfo(bi);
Stream stream = BlobInfoProvider.GetBlobContent(bi);
...........

What can be the problem? We copied the code from GetAzureFile.aspx.cs

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 12/21/2011 7:41:47 AM
   
RE:Load XML file from devstoreaccount usinig CMS.AzureHelper
Hello,

Could you please post the complete stack trace of your error? The given method could fail on multiple occasions so we will need more details on this.

Best regards,
Boris Pocatko

User avatar
Member
Member
Punt - 12/21/2011 8:36:25 AM
   
RE:Load XML file from devstoreaccount usinig CMS.AzureHelper
Hello Boris,

We managed to fix it but we used the Microsoft.WindowsAzure and Microsoft.WindowsAzure.StorageClient namespaces and use the DownloadText method instead.

Here the stack trace of the exception of my first post:

System.NullReferenceException was unhandled by user code
Message=Object reference not set to an instance of an object.
Source=CMS.SettingsProvider
StackTrace:
at CMS.SettingsProvider.AzureHelper.get_TempPath()
at CMS.AzureStorage.BlobInfoProvider.GetBlobContent(BlobInfo bi)
at Web._Default.btnLoadFile_Click(Object sender, EventArgs e) in C:\Projects\VS2010\AzureBlobStorage\Web\Default.aspx.cs:line 38
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:

Regards,

Edgar Apeldoorn
SnelStart

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 1/4/2012 3:27:02 AM
   
RE:Load XML file from devstoreaccount usinig CMS.AzureHelper
Hello,

Are you running your code underneath Kentico in a Windows Azure environment or do you only use the blob storage for your custom code? The problem might be, that the web config parameters CMSAzureTempPath and CMSAzureCachePath aren't initialized, if you are not using Kentico under Azure. There are two types of virtual memory available in Kentico for minimizing blob requests, which are slower. One is called AzureTemp and one is called AzureCache. So, to go around this, please try to use your old code and specify some path to those web.config parameters.

Best regards,
Boris Pocatko