title: MVC3 Web Project Error: "An attempt was made to access a socket in a way forbidden by its access permissions 10.10.0.1:3128"
body: <p>I published my MVC3 web project to Azure. When I tried to authorize with fb, I get an error below.</p>
  
  <p>Additional info:</p>
  
  <ul>
  <li>callbackUrl = <a href="http://site.azurewebsites.net/Facebook/AddSocialAccount" rel="nofollow">http://site.azurewebsites.net/Facebook/AddSocialAccount</a></li>
  <li>аuthenticateUrl = <a href="https://graph.facebook.com/oauth/authorize?client_id=" rel="nofollow">https://graph.facebook.com/oauth/authorize?client_id=</a><em>*</em>&amp;response_type=code&amp;redirect_uri=http%3A%2F%2Fsite.azurewebsites.net%2FFacebook%2FAddSocialAccount&amp;scope=publish_stream%2Cemail%2Cuser_birthday</li>
  </ul>
  
  <p>so the app authorizes on fb, goes to AddSocialAccount action and fails int the string:</p>
  
  <pre><code>var profile = this.Provider.GetUserProfile(code);
  </code></pre>
  
  <p>where goes to:</p>
  
  <pre><code>protected override Task&lt;AccessGrant&gt; PostForAccessGrantAsync(string accessTokenUrl, NameValueCollection request)
      {
          return this.RestTemplate.PostForObjectAsync&lt;NameValueCollection&gt;(accessTokenUrl, request)
              .ContinueWith&lt;AccessGrant&gt;(task =&gt;
              {
                  string expires = task.Result["expires"];
                  return new AccessGrant(task.Result["access_token"], null, null, expires != null ? new Nullable&lt;int&gt;(Int32.Parse(expires)) : null);
              });
      }
  </code></pre>
  
  <p>and string with error is </p>
  
  <pre><code>string expires = task.Result["expires"];
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Server Error in '/' Application.
  enter code here
  An attempt was made to access a socket in a way forbidden by its access permissions 10.10.0.1:3128
  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: An attempt was made to access a socket in a way forbidden by its access permissions 10.10.0.1:3128
  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 (0x271d): An attempt was made to access a socket in a way forbidden by its access permissions 10.10.0.1:3128]
  System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) +6462061
  System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket&amp; socket, IPAddress&amp; address, ConnectSocketState state, IAsyncResult asyncResult, Exception&amp; exception) +271
  [WebException: Unable to connect to the remote server]
  System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext&amp; context) +2233126
  System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult) +14
  Spring.Http.Client.WebClientHttpRequest.ExecuteRequestCallback(IAsyncResult result) in f:\bamboo-home\xml-data\build-dir\SPRNETREST-RELEASE-JOB1\src\Spring.Rest\Http\Client\WebClientHttpRequest.cs:246
  [AggregateException: One or more errors occurred.]
  System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) +3548265
  System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) +73
  System.Threading.Tasks.Task`1.get_Result() +10486829
  Project.Social.Facebook.Api.Impl.FacebookOAuth2Template.&lt;PostForAccessGrantAsync&gt;b__0(Task`1 task) in D:\Code\Poll\Project.Social\Facebook\Api\Impl\FacebookOAuth2Template.cs:23
  System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() +81
  System.Threading.Tasks.Task.Execute() +49
  
  [AggregateException: One or more errors occurred.]   
  System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) +3548265
  System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) +73
  System.Threading.Tasks.Task`1.get_Result() +10486829
  Project.Social.Base.OAuth2SocialProvider`4.SetAccessToken(String code) in    D:\Code\Poll\Project.Social\Base\OAuth2SocialProvider.cs:49
  Project.Social.Base.OAuth2SocialProvider`4.GetServiceClient(String oauth_verifier) in D:\Code\Poll\Project.Social\Base\OAuth2SocialProvider.cs:66
  Project.Social.Facebook.FacebookProvider.GetUserProfile(String oauth_verifier) in D:\Code\Poll\Project.Social\Facebook\FacebookProvider.cs:26   Project.Areas.FrontEnd.Controllers.ControllersBase.OAuthControllerBase`3.AddSocialAccount(String code, String oauth_verifier) in D:\Code\Poll\Project\Areas\FrontEnd\Controllers\ControllersBase\OAuthControllerBase.cs:112
  lambda_method(Closure , ControllerBase , Object[] ) +147
  System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
  System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +214
  System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
  System.Web.Mvc.&lt;&gt;c__DisplayClass15.&lt;InvokeActionMethodWithFilters&gt;b__12() +55
  System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +253
  System.Web.Mvc.&lt;&gt;c__DisplayClass17.&lt;InvokeActionMethodWithFilters&gt;b__14() +21
  System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +253
  System.Web.Mvc.&lt;&gt;c__DisplayClass17.&lt;InvokeActionMethodWithFilters&gt;b__14() +21
  System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
  System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +324
  System.Web.Mvc.Controller.ExecuteCore() +106
  System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +91
  System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
  System.Web.Mvc.&lt;&gt;c__DisplayClassb.&lt;BeginProcessRequest&gt;b__5() +34
  System.Web.Mvc.Async.&lt;&gt;c__DisplayClass1.&lt;MakeVoidDelegate&gt;b__0() +19
  System.Web.Mvc.Async.&lt;&gt;c__DisplayClass8`1.&lt;BeginSynchronous&gt;b__7(IAsyncResult _) +10
  System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
  System.Web.Mvc.&lt;&gt;c__DisplayClasse.&lt;EndProcessRequest&gt;b__d() +48
  System.Web.Mvc.SecurityUtil.&lt;GetCallInAppTrustThunk&gt;b__0(Action f) +7
  System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
  System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
  System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
  System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9629708
  System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155
  </code></pre>
  
  <p>When I use local computer with connectionString of Azure I don't get this error(I change the domain and url on fb).
  Thanks for any ideas!</p>