ok im having some issues, and have been stumped for a few days here. I am trying to access azure blob storage. I couldnt make heads or tails of the rest api, so I decided to try a native plugin. I have pro so i thought why not. But the plugin I wrote relies on another dll which in turn relies on another dll. unity doesn't seem to like this. I have tried everything i could find on the web so far. I have placed the other dlls in the same folder, in the project folder, in the editor root folder, system32, and systemWOW64. When i made a test function that removed the need for the other dlls unity could magically find it but when i have the other functions required then it says " Failed to load 'Assets/Plugins/x86_64/AzureSGPlugin.dll' with error 'The specified module could not be found. ', GetDllDirectory returned ''. If GetDllDirectory returned non empty path, check that you're using SetDirectoryDll correctly." I would love some help.
You don't state anywhere if you have placed your dll in the Plugins folder in your Unity project and since that is a requirement, I wanted to make sure about that first. And Plugins with a capital "P"
External DLLs don't have to be in the plugins folder. They will work fine in any folder as long as they're not actually "plugins" or editor extensions. My guess here is that that AzureGSPlugin.dll is built against .NET 4.0 or 4.5 which means it won't load. You can only use assemblies that target .NET 3.5 and below (and even then those assemblies may have other dependencies or dependencies that aren't available under the correct .NET version).
it's actually its a c++ plugin so no .net issues. And it is in the plugin folder. I can get it to work if I remove the dependency on the second all, but then I can't get the function I need from it
Oh yeah, if its c++ then it needs to be in the plugins folder. Something with that second DLL is incompatible then. It may require a reference to a resource Unity doesn't have access to.
so the chain of things is my azure plugin requires wastorage.dll, which requires cpprest120_2_6.dll. I think that there is some sort of linking issue, because even dependancywalker seems to have issue with it. it says that my azure plugin requires cpp but it cannot be found. i think im going to ditch the plugin idea all together and just do some serverside php
eww PHP. Although using a server proxy is a good idea anyway. You don't want to be exposing your Azure credentials inside your game code. Blob Storage I believe supports a RESTful API as well. Also have a look at the new Azure DocumentDB. It's quite nice and RESTful as well. And you can story binary data as Attachments which uses Azure Blob Storage as the backing. http://azure.microsoft.com/en-us/services/documentdb/ $25 / hr gets you 10 GB of storage and 250 request units / second http://azure.microsoft.com/en-us/pricing/details/documentdb/
Yea the first thing i tried to do was the rest api, I couldnt manage to get it to work. I was having issues getting the uri correct. I ran into issues creating the sas portion. I am not at all familiar with building a uri, and all of the tutorials i could find used .net 4.0 features. :/ I have just been trying to store map data. I built a runtime level editor for my game im working on, and I wanted players to be able to share them.
I found one other person on the forums trying to do a similar thing but they were having problems too. They fixed theirs but didnt post the fix. http://forum.unity3d.com/threads/us...t-to-an-azure-blob-store.227494/#post-2146316
I can help you look at it. I have free azure resources with my msdn. I could answer any of your Uri questions as well.
I have some azure resources through msdn too, that's why I thought of using it. So first off, thank you, I really appreciate it. I have never really dealt with rest through httprequests so I had followed what this guys was doing after trying on my own for a few days Code (CSharp): public class DatabaseClient : MonoBehaviour { string accessKey = "myAccessKeyFromAzureStorageManageAccessKey=="; string accountName = "accountName"; string container = "test"; //Storage container created on azure portal called "test" // Use this for initialization void Start () { GetBlob_Test(); } // Update is called once per frame void Update () { } // GetBlob_Test void GetBlob_Test() { Debug.Log ("Attempting to GET from server"); DateTime dt = DateTime.UtcNow; string stringToSign = String.Format("GET\n" + "\n" // content md5 + "\n" // content type + "x-ms-date:" + dt.ToString("R") + "\nx-ms-version:2012-02-12\n" // headers + "/{0}/{1}\ncomp:list\nrestype:container", accountName, container); string authorizationKey = SignThis(stringToSign, accessKey, accountName); string method = "GET"; string urlPath = string.Format("https://{0}.blob.core.windows.net/{1}?restype=container&comp=list", accountName, container); Uri uriTest = new Uri(urlPath); HttpWebRequest request = (HttpWebRequest)WebRequest.Create (uriTest); request.Method = method; request.Headers.Add("x-ms-date", dt.ToString("R")); request.Headers.Add("x-ms-version", "2012-02-12"); request.Headers.Add("Authorization", authorizationKey); Debug.Log ("Authorization: " + authorizationKey); using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { Debug.Log("Response = " + response); } } private static String SignThis(String StringToSign, string Key, string Account) { String signature = string.Empty; byte[] unicodeKey = Convert.FromBase64String(Key); using (HMACSHA256 hmacSha256 = new HMACSHA256(unicodeKey)) { Byte[] dataToHmac = System.Text.Encoding.UTF8.GetBytes(StringToSign); signature = Convert.ToBase64String(hmacSha256.ComputeHash(dataToHmac)); } String authorizationHeader = String.Format( CultureInfo.InvariantCulture, "{0} {1}:{2}", "SharedKeyLite", Account, signature); return authorizationHeader; } } even though they had said they were having trouble with it, I figured that I might be able to fix whatever problem they were having and then make something usable. I need to be able to do three things with the blob storage. I need to be able to upload files, they are just xml files, but I dont know if that matters. I need to be able to list the blobs in a container. And I need to be able to download a blob. All from c#. I have read through all of the documentation on msdn on interacting with blob storage through rest, but to be honest it didn't make much sense to me. I know that I need to have the base URL along with a verb, such as GET, and the shared access signature. I just don't know how to correctly format it into a URI that works.
Hey @angelsin, thank you very much for providing your script! Just wanted to ask where I can find the "SerializeHelper" class? Can't solve that error atm ...
I'm out of the house right now, but the serialize helper was just the class I wrote to handle serializing objects to xml strings and back. You could put whatever solution for generating a string from an object you want there. If you want I could post some of that too, but I got it mainly from msdn
Thanks @angelsin for your scripts! Big help. Just a side project but been confused by this for a while.