Windows Azure结束连接并返回324错误代码

Flo*_*ent 8 c# azure azure-storage azure-storage-emulator

我在Windows Azure中尝试过一些实验室,它运行正常.所以,我开始使用Azure Emulator开发我的应用程序.

我今天在Windows Azure中执行了我的第一个部署测试并且遇到了第一个问题:

No connection could be made because the target machine actively refused it 127.0.0.1:10000

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:10000

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[SocketException (0x274d): No connection could be made because the target machine actively refused it 127.0.0.1:10000]
   System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) +2724507
   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +392

[WebException: Unable to connect to the remote server]
   Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result() +96
   Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.ExecuteAndWait() +271
   Microsoft.WindowsAzure.StorageClient.CloudBlobContainer.Delete(BlobRequestOptions options) +213
   MyProject.Web.MvcApplication.InitBlobs() in C:\Sites\MyProject\MyProject\MyProject.Web\Global.asax.cs:85
   MyProject.Web.MvcApplication.Application_Start() in C:\Sites\MyProject\MyProject\MyProject.Web\Global.asax.cs:52
Run Code Online (Sandbox Code Playgroud)

这是第一次部署,所以我试图删除一个不存在的容器.我现在处理异常.

我重新部署我的项目,并没有得到任何服务器错误.它只是结束连接并给我这个错误:Error 324 (net::ERR_EMPTY_RESPONSE)

我假设我在配置中遗漏了一些东西,但我无法找到它的确切内容.

谢谢您的帮助!

编辑:部署本身是此应用程序的第一个部署,但它不是我在Windows Azure上执行的第一个部署.当我开始为Windows Azure开发时,我已经部署了一些msdn实验室.

Chr*_*nig 6

好的 - 我能够重现这一点,问题在于您的云部署项目的配置.

我的错误版本

我收到此错误的原因是因为我将存储连接字符串设置为指向"UseDevelopmentStorage=true;".相反,您需要使用Azure部署项目中的连接字符串工具来更改ConfigurationManager获取其连接字符串的位置,并使用一个用于本地开发,另一个用于部署到云:

  • 打开Windows Azure项目并找到" 角色"节点.
  • 双击WebRole项目以打开配置面板
  • 单击" 设置"选项卡以显示为项目定义的所有不同设置.你可能会看到这样的东西:

配置面板

  • 注意Service Configuration顶部的组合框.我的设置,如画面中显示,目前表明,该StorageConnectionString设置将被应用到两个云和本地部署.那很糟.
  • 看到它下面的那个?第二个?那个<Select Configuration>值显示在Value列中,因为该值将取决于您正在运行的配置.

要解决此问题,需要将服务配置更改为Cloud然后调整设置:

  • Service Configuration设置更改为Cloud
  • 单击StorageConnectionString设置末尾的elipses,然后选择Enter storage credentials.

配置设置

  • 保存此对话框和配置设置页面,然后返回到创建CloudStorageAccount客户端的代码.
  • 在您需要获取连接字符串以创建客户端的位置,请使用以下代码段:

    //从连接字符串中检索存储帐户CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));

  • storageAccount现在基于是否要发布到云端或本地的正确连接字符串装载.

部署向导运行时,它将自动拉入设置,同时保留本地设置以在调试器中运行.

试试这个,让我知道它是否适合你.我很乐意加入Lync会议来完成您的代码,如果您对此开放,请将其修复...


Flo*_*ent 4

好吧,我知道我的错误是什么了。

出于对抽象的渴望,我设计了一个解决方案,在我的应用程序中仅很少使用 blob 连接。对 blob 存储进行了 3 次调用。

  • 我的一个Global.asax
  • 一中一BlobService
  • 一中一ExtensionMethod

我多次检查了 Global.asax 和 BlobService,但忘记了 ExtensionMethod。我在项目开始时编写了它,并且仅在开发过程中通过以下指令访问我的 blob 帐户:CloudStorageAccount.DevelopmentStorageAccount而不是CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("BlobConnection"))

Chris Koening 的回答部分正确,因为我在云中时尝试访问开发存储。如果您在这个问题中遇到同样的问题,我的建议是:

  1. 执行克里斯的回答
  2. 如果它不能解决您的问题,请尝试DevelopmentStorageAccount通过 Visual Studio 搜索工具或Agent Ransack在整个解决方案中查找该字符串,并将其替换为您在第一步中定义的密钥
  3. 如果仍然不能解决您的问题,请尝试查找其他地方是否有对 DevelopmentStorage 的引用