Windows Azure ends connection and returns a 324 error code
-
26-06-2021 - |
Pergunta
I have tried some labs in Windows Azure and it works fine. So, I start developing my application with Azure Emulator.
I perform my first deployment test today in Windows Azure and have a first issue:
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)
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. I already deployed some msdn labs when I start developing for Windows Azure.
Solução 2
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. There was 3 call to the blob storage.
- One in my
Global.asax
- One in a
BlobService
- One in an
ExtensionMethod
I checked several times my Global.asax and BlobService but forgot the 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"))
Chris Koening answer was partially right, because I was trying to access development storage whereas I was in the Cloud. If you have the same problem describe in this question, my advise would be:
- Execute Chris answer
- If it doesn't solve your issue, try to find the
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 - If it still doesn't solve your issue, try to find if there is any reference to the DevelopmentStorage anywhere else
Outras dicas
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;"
. 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:
- Open your Windows Azure Project and find the Roles node.
- Double-click on your WebRole project to open the configuration panel
- Click on the Settings tab to show all the different settings defined for your project. You will probably see something like this:
- Notice the
Service Configuration
combo box at the top. My settings, as displayed in the picture, currently indicate that theStorageConnectionString
setting will be applied to both the Cloud and the Local deployments. That's bad. - See the one beneath it? The second one? That one shows
<Select Configuration>
in the Value column as the value will be dependent on which configuration you're running.
To fix this, it's a matter of changing the Service Configuration to Cloud
and then adjusting the settings:
- Change the
Service Configuration
setting to Cloud - Click on the elipses at the end of the
StorageConnectionString
setting and choose Enter storage credentials.
- Save this dialog, and the configuration settings page, and go back into your code where you create the
CloudStorageAccount
client. 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"));
The
storageAccount
is now loaded from the correct connection string based on whether you're publishing to Cloud or 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...
Your problem is specific to the component installed on your machine, rather then 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. 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.
You can also modify your Application setting to run either on IISExpress (default) or IIS Server to see there is change in problem behavior. 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.