locked
Inserting an image into the blob storage, from a website on Azure servers. RRS feed

  • Question

  • We have  MobileService as part of our Cloud service. This service enables uploading of Images, which will later be used by the Cloud service.
     
    1. This Mobile Service contains one table in order to connect with a blobStorage Service.
    2. We have a website on Azure which connects to this Mobile Service - This site was created using HTML/JavaScript tab on the mobile service. I followed the process on that page to connect to the mobile service. That is added the following
     
    <script src="http://xxxmobileservice.azure-mobile.net/client/MobileServices.Web-1.0.0.min.js"></script>
    
    Then Instantiated the client by doing this:
    var client = new WindowsAzure.MobileServiceClient(
     "https://xxxxxmobileservice.azure-mobile.net/",
     "XEkfiTyqhOyiEIncynGYEsFQydaMHj55"
     );
    When I first tried to insert a record in the table I got an error - About cross origin requests. So I added localhost and our web domain name to the "Cross-Origin Resource Sharing (CORS)" section of the mobile service. After doing this I was able to insert a record into the table and get back a SASUri to upload the image blob. When I use this SASUri to upload the blob I am running into issues. I am also following this article  to upload the blob:
     
    http://gauravmantri.com/2013/02/16/uploading-large-files-in-windows-azure-blob-storage-using-shared-access-signature-html-and-javascript/
     
    Anyway: Here's the error I am seeing:
     
    I get the following message in the network panel of IE10:
    URL Method Result Type Received Taken Initiator Wait‎‎ Start‎‎ Request‎‎ Response‎‎ Cache read‎‎ Gap‎‎
    https://xxxxx.blob.core.windows.net/xxxblobservice-album1/90f5d980-7c3d-419e-8623-11a6103a9df7.jpeg?se=2013-04-24T22%3A10%3A46Z&sr=b&sp=w&sig=COVbiWxbD8MuPHXWLQzE9ve8hByA6aZqoNwmm6WlOZU%3D&comp=block&blockid=YmxvY2stMDAwMDAw 
     
     
    OPTIONS (Aborted)  229 B 31 ms CORS Preflight 3141 0 31 0 0 0
    The detailed response header is as follows:
    Response: HTTP/1.1 405 The resource doesn't support specified Http Verb.
    Transfer-Encoding: chunked
    Allow: PUT
    Server: Microsoft-HTTPAPI/2.0
    x-ms-request-id: f4b08c02-0fc4-44a0-adf2-490775eae775
    Date: Wed, 24 Apr 2013 22:09:37 GMT
     

    Is there any setting on the server that I have overlooked or should the HTML/JavaScript  web client be written in a different way? Does this have something to do with CORS? Let me know if you need any other information.

    I read about some suggestions to host the pages in the blob container itself.  I encounter the same issue after hosting the webpage in the blobstorage container.

    Any help would be greatly appreciated!

    Thanks.

    Thursday, May 2, 2013 3:50 PM

All replies