[英]Windows Azure ends connection and returns a 324 error code
I have tried some labs in Windows Azure and it works fine. 我在Windows Azure中尝试过一些实验室,它运行正常。 So, I start developing my application with Azure Emulator.
所以,我开始使用Azure Emulator开发我的应用程序。
I perform my first deployment test today in Windows Azure and have a first issue: 我今天在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
It was the first deployment, so I tried to delete a container that doesn't exist. 这是第一次部署,所以我试图删除一个不存在的容器。 I now handle the Exception.
我现在处理异常。
I redeploy my project and doesn't get any server error. 我重新部署我的项目,并没有得到任何服务器错误。 It just ends the connection and leave me this error:
Error 324 (net::ERR_EMPTY_RESPONSE)
它只是结束连接并给我留下这个错误:
Error 324 (net::ERR_EMPTY_RESPONSE)
I assume I miss something in my configuration but I wasn't able to find what it is exactly. 我假设我错过了我的配置,但我无法找到它的确切内容。
Thank you for your help! 谢谢您的帮助!
Edit: The deployment itself is the first one for this application, but it isn't the first one I perform on Windows Azure. 编辑:部署本身是此应用程序的第一个部署,但它不是我在Windows Azure上执行的第一个部署。 I already deployed some msdn labs when I start developing for Windows Azure.
当我开始为Windows Azure开发时,我已经部署了一些msdn实验室。
OK - I was able to reproduce this, and the problem is with the configuration of your cloud deployment project. 好的 - 我能够重现这一点,问题在于您的云部署项目的配置。
The reason I got this error is because I set the storage connection string to point to "UseDevelopmentStorage=true;"
我收到此错误的原因是因为我将存储连接字符串设置为指向
"UseDevelopmentStorage=true;"
. 。 Instead you need to use the Connection String tool in your Azure Deployment Project to change where the
ConfigurationManager
gets its connection string and have one for Local development and a different one for deploying to the Cloud: 相反,您需要使用Azure部署项目中的连接字符串工具来更改
ConfigurationManager
获取其连接字符串的位置,并使用一个用于本地开发,另一个用于部署到云:
Service Configuration
combo box at the top. Service Configuration
组合框。 My settings, as displayed in the picture, currently indicate that the StorageConnectionString
setting will be applied to both the Cloud and the Local deployments. StorageConnectionString
设置将被应用到云和本地部署。 That's bad. <Select Configuration>
in the Value column as the value will be dependent on which configuration you're running. <Select Configuration>
,因为该值取决于您正在运行的配置。 To fix this, it's a matter of changing the Service Configuration to Cloud
and then adjusting the settings: 要解决此问题,需要将服务配置更改为
Cloud
,然后调整设置:
Service Configuration
setting to Cloud Service Configuration
设置更改为“ 云” StorageConnectionString
setting and choose Enter storage credentials . StorageConnectionString
设置末尾的elipses,然后选择Enter storage credentials 。 CloudStorageAccount
client. CloudStorageAccount
客户端的代码。 In the place that you need to get the connection string to create the client, use the following snippet: 在您需要获取连接字符串以创建客户端的位置,请使用以下代码段:
// Retrieve storage account from connection-string CloudStorageAccount storageAccount = CloudStorageAccount.Parse( CloudConfigurationManager.GetSetting("StorageConnectionString")); //从连接字符串中检索存储帐户CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(“StorageConnectionString”));
The storageAccount
is now loaded from the correct connection string based on whether you're publishing to Cloud or Local. 现在,
storageAccount
是根据您是发布到Cloud还是Local来从正确的连接字符串加载的。
When the deployment wizard runs, it will pull in the Cloud settings automatically, while preserving the Local settings for running in the debugger. 部署向导运行时,它将自动拉入云设置,同时保留本地设置以在调试器中运行。
Try this out and let me know if it doesn't work for you. 试试这个,让我知道它是否适合你。 I'd be happy to join a Lync meeting to walk through your code and get this fixed up if you're open to that...
我很乐意加入Lync会议来完成您的代码,如果您对此开放,请将其修复...
Ok, I figured out what my mistake was. 好的,我弄明白了我的错误。
In my desire of abstraction, I designed a solution where I used the blob connection only a very few time in my app. 在我对抽象的渴望中,我设计了一个解决方案,我在我的应用程序中只使用了很少的blob连接。 There was 3 call to the blob storage.
有3次调用blob存储。
Global.asax
Global.asax
BlobService
BlobService
ExtensionMethod
ExtensionMethod
I checked several times my Global.asax and BlobService but forgot the ExtensionMethod. 我多次检查了我的Global.asax和BlobService,但忘记了ExtensionMethod。 I wrote it in the beginning of my project and I was accessing my blob account only in development by the following instruction:
CloudStorageAccount.DevelopmentStorageAccount
instead of CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("BlobConnection"))
我在项目开始时写了它,我只是在开发中通过以下指令访问我的blob帐户:
CloudStorageAccount.DevelopmentStorageAccount
而不是CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("BlobConnection"))
Chris Koening answer was partially right, because I was trying to access development storage whereas I was in the Cloud. Chris Koening的回答是部分正确的,因为我试图访问开发存储,而我在云中。 If you have the same problem describe in this question, my advise would be:
如果您在此问题中描述的问题相同,我的建议是:
DevelopmentStorageAccount
string in your entire solution via Visual Studio search tool or Agent Ransack and replace it with the key you defined in first step DevelopmentStorageAccount
字符串,并将其替换为您在第一步中定义的密钥 Your problem is specific to the component installed on your machine, rather then Windows Azure Specific. 您的问题特定于计算机上安装的组件,而不是Windows Azure Specific。 I can provide a few pointers to troubleshoot such problem however it would be very hard to pinpoint one specific root cause.
我可以提供一些指导来解决这样的问题,但是很难确定一个特定的根本原因。
What you can do it just create a very simple Web Role application directly from template and then run it in Windows Azure Emulator to see if that works fine or not. 您可以做什么只是直接从模板创建一个非常简单的Web角色应用程序,然后在Windows Azure模拟器中运行它,看看它是否正常工作。 This way you can distinguish if your problem is specific to your code or not.
这样,您就可以区分问题是否特定于您的代码。 If you hit the exact same problem with a simple test app, then your problem is more of Windows Azure components related.
如果您使用简单的测试应用程序遇到完全相同的问题,那么您的问题更多的是与Windows Azure组件相关。
You can also modify your Application setting to run either on IISExpress (default) or IIS Server to see there is change in problem behavior. 您还可以修改应用程序设置以在IISExpress(默认)或IIS服务器上运行,以查看问题行为是否发生变化。 If you get exact same error with both IIS Server and IIS Express, then you can focus on your Windows Azure components to troubleshoot the problem.
如果IIS服务器和IIS Express都出现完全相同的错误,那么您可以专注于Windows Azure组件以解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.