集装箱创作Azure的斑点400错误的请求 [英] Azure Blob 400 Bad request on Creation of container

查看:297
本文介绍了集装箱创作Azure的斑点400错误的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个ASP.Net MVC 4应用程序,我使用的Azure的Blob存储我的用户要上传的图片。我有以下的code:

I'm developing an ASP.Net MVC 4 app and I'm using Azure Blob to store the images that my users are going to upload. I have the following code:

 var storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["StorageConnection"].ConnectionString);

 var blobStorage = storageAccount.CreateCloudBlobClient();
 //merchantKey is just a GUID that is asociated with the merchant
 var containerName = ("ImageAds-" + merchant.merchantKey.ToString()).ToLower();
 CloudBlobContainer container = blobStorage.GetContainerReference(containerName);
 if (container.CreateIfNotExist())
    {
       //Upload the file
    } 

只要if语句excecuted我得到了以下异常:

as soon as the if statement is excecuted I'm getting the following exception:

  {"The remote server returned an error: (400) Bad Request."}

我还以为是容器的名字,但我看不出有什么不妥的地方。连接字符串似乎产生了与团块所有细节一个良好的存储。我不知所措。我研究网络和每个人都在说,它的命名问题,但我似乎什么错不能用它。

I thought it was the container's name but I don't see anything wrong with it. The connection string seems to create a good storage with all details for the blob. I'm at a loss. I've researched the web and everyone is saying its a naming problem but I can't seem anything wrong with it.

测试容器的名字,我用: imageads-57905553-8585-4d7c-8270-be9e611eda81

Test Container name that I used: imageads-57905553-8585-4d7c-8270-be9e611eda81

容器具有以下URI: <$c$c>{http://127.0.0.1:10000/devstoreaccount1/imageads-57905553-8585-4d7c-8270-be9e611eda81}

The Container has the following uri: {http://127.0.0.1:10000/devstoreaccount1/imageads-57905553-8585-4d7c-8270-be9e611eda81}

更新:
我已经改变了容器名称,只是图片,我仍然会得到相同的异常。还开发连接字符串如下:&LT;添加名称=StorageConnection的connectionString =UseDevelopmentStorage =真正的/&GT;

UPDATE: I have changed the container name to just image and I still get the same exception. also the development connection string is as follows: <add name="StorageConnection" connectionString="UseDevelopmentStorage=true" />

推荐答案

其实我最终发现问题。

I actually ended up finding the problem.

我的问题是,Blob存储仿真器将无法启动(其它模拟器会开始,我错过了BLOB)。这个问题最终被该端口10000(默认BLOB仿真器端口)已经被另一个软件。我用用netstat CMD的工具,看看它是哪一个软件,杀了它和它现在的工作就像一个魅力!谢谢大家!

My problem was that the blob storage emulator would not start (the other emulators would start and I missed the blob). The problem ended up being that the port 10000 (default blob emulator port) was already being used by another software. I used Netstat cmd tool to see which software it was, killed it and its now working like a charm!!! Thanks everyone!!

这篇关于集装箱创作Azure的斑点400错误的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆