Friday 15 May 2015

c# - Why does CloudBlobClient.BaseUri add a trailing slash (sometimes)? -


I think this is a bug, but I'm not sure I'm starting. Here's my situation.

Setup information

I have a website that allows uploads for Azure Storage Blob, and webpages. In Base Web Configuration

  & lt; BlobEndpoint value = "http://127.0.0.1:10000/devstoreaccount1" />   

and in the test server web configuration

  & lt; BlobEndpoint value = "https://myazureaccount.blob.core.windows.net" xdt: transform = "change" />   

I have a custom configuration handler so that the value can be obtained from web config.

  [ConfigurationProperty ( "blobEndpoint", IsRequired = true)] public string configuration Element Bboindpoint {return (String Configusn Element) base [ "Blobandpoint"]; } Set {base ["blobEndpoint"] = value; }}   

I get a reference to the storage account

  StorageCredentialsAccountAndKey credentials = new StorageCredentialsAccountAndKey (CloudStorageAccount.CloudStorageAccountName, CloudStorageAccount.CloudStorageAccountKey); This.cloudStorageAccount = New CloudStorageAccount (Credentials, CloudStorageAccount.BlobEndpoint, CloudStorageAccount.QueueEndpoint, CloudStorageAccount.TableEndpoint);   

Then get the Cloud Blob client this way

  this.cloudBlobClient = this.cloudStorageAccount.CreateCloudBlobClient ();   

Problem in hand

This is where I start getting different results.

If I use the storage emulator endpoint ( http://127.0.0.1:10000/devstoreaccount1 ) and call it

  This.cloudBlobClient.BaseUri   

Return value http://127.0.0.1:10000/devstoreaccount1

However, if I make my actual Account endpoint (use https: // myazureaccount) Blob.core.windows.net ) and make a single call, return value is https: //myazureaccount.blob.core .windows.net / .

Finally, follow the trailing slash. Why using a storage emulator when using not or real

update

present when using a < Strong> is why it exists? Web configuration settings and this was the output of each case

  {https://myazureaccount.blob.core.windows.net/} AbsolutePath: "/" AbsoluteUri: "https: // myazureaccount. blob.core.windows.net / "Authority" Myazureaccountkblobkcorekwindowsknet "DnsSafeHost:" Myazureaccountkblobkcorekwindowsknet "piece:" "host:" myazureaccount.blob.core.windows. net "HostNameType: DNS IsAbsoluteUri: true IsDefaultPort: true IsFile: false IsLoopback: false IsUnc: false LocalPath:" / "OriginalString:" https://myazureaccount.blob.core.windows.net "PathAndQuery:" / "Port: 443 question: "" plan: "https" segment: {string [1]} UserEscaped: false UserInfo: "" {} http://127.0.0.1:10000/devstoreaccount1 AbsolutePath: "/ devstoreaccount1" AbsoluteUri: "http: / / 127.0.0.1: 10000 / devstoreaccount1 "Authority" L27k0k0kl:l0000 "Dianssifihost:" 127.0.0.1 "piece:" "Host:" 127.0.0.1 "HostNameType: Aipivi 4 IsAbsoluteUri: true IsDefaultPort: false IsFile: false IsLoopback: true IsUnc: False LocalPath: "/ devstoreaccount1" OriginalString: "http://127.0.0.1:10000/devstoreaccount1" PathAndQuery: "/ devstoreaccount1" Port: 10000 Query: "Plan": "http" Segment: {string [2]} UserEcaped: Wrong UserInfo: ""   

And it appears that it is not really related to URI class and CloudBlobClient . I've updated the tag appropriately.

Looks like the same thing that could be

  Path and Other: "/"   

Remove that thing and work properly. If you need to test the URI class then I have written to you very soon that you can use it, in the future you will be able to return the correct host URI class for a lot of time to test And will save the headache. var uriList = new list & lt; String & gt; () {"Https://myazureaccount.blob.core.windows.net", "https://myazureaccount1.blob.core.windows. Net", "https://myazureaccount2.blob.core.windows.net" }; Var Holdlist = Yuri List Select (uriname => New Yuri (uranium)). Select (Yuri => Yuri.Host) .Olist ();

No comments:

Post a Comment