Thursday, November 15, 2012

Azure Blob Upload - SocketException

Today when I deployed my MVC 4 application to azure, when I tried to access the blob, I got the following error,

An attempt was made to access a socket in a way forbidden by its access permissions 127.0.0.1:10000

[SocketException (0x271d): An attempt was made to access a socket in a way forbidden by its access permissions 127.0.0.1:10000]
   System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) +6462061
   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) +271

[WebException: Unable to connect to the remote server]
   Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result() +77
   Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.ExecuteAndWait() +171
   Microsoft.WindowsAzure.StorageClient.TaskImplHelper.ExecuteImplWithRetry(Func`2 impl, RetryPolicy policy) +29
   Microsoft.WindowsAzure.StorageClient.CloudBlobContainer.CreateIfNotExist(BlobRequestOptions options) +93
   AzurePictures.Models.ImageRepository.SaveImage(String name, Byte[] buffer) +109
   AzurePictures.Controllers.HomeController.Upload() +316


The issue is when I deployed the application, I am still setting it to useDevelopmentStorage = true,
Just reset the web config to use the Azure one, then it worked.

No comments: