Total confusion - Azure/RavenHQ - help!!

337 views
Skip to first unread message

Jeremy Holt

unread,
Sep 15, 2014, 6:45:24 PM9/15/14
to rav...@googlegroups.com
Hi,

After reading various comments about using a VM on Azure particularly this article by Troy Hunt http://www.troyhunt.com/2014/01/with-great-azure-vm-comes-great.html I decided to go with hosting my database on RavenHQ and creating a free website on Azure.

I setup the database on RavenHQ, imported my data, and have no problems in seeing the remote data using Studio.

I created the free website on Azure, and set it up for automatic deployment from my Github account (seems almost too easy!).

I changed my Global.asax to initialize the DocumentStore using the connection string provided by RavenHQ, including the ApiKey.

private static IDocumentStore RemoteDocumentStore()
   {
       return new DocumentStore
       {
           Url = "https://cornhousebiz-atla.ravenhq.com/databases/cornhousebiz-AcpProductionDb",
           ApiKey = "<ApiKey>",
           Conventions = new DocumentConvention
           {
               IdentityPartsSeparator = "-",
               FailoverBehavior = FailoverBehavior.FailImmediately
           }
       };
   }

Problems:

I ran the app locally and immediately got: "No connection could be made because the target machine actively refused it 127.0.0.1:8888". This is probably down to my crap internet connection.

I gave up on trying to run the app locally accessing the remote data, and tried to run it directly from the Azure management page.

I then got an error about being unable to PUT to the replication service. I changed the FailoverBehavior to FailoverBehavior.FailImmediately, published again, and managed to get past this error.

When trying to run the app from Azure I am now getting:

[SocketException (0x271d): An attempt was made to access a socket in a way forbidden by its access permissions 127.0.0.1:8888]
   System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +208
   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) +464

[WebException: Unable to connect to the remote server]
   System.Net.HttpWebRequest.GetResponse() +6540964
   Raven.Client.Connection.HttpJsonRequest.ReadJsonInternal(Func`1 getResponse) +89
   Raven.Client.Connection.HttpJsonRequest.ReadResponseJson() +351
   Raven.Client.Connection.ServerClient.DirectPutIndex(String name, OperationMetadata operationMetadata, Boolean overwrite, IndexDefinition definition) +380
   Raven.Client.Connection.<>c__DisplayClass5e.<PutIndex>b__5d(OperationMetadata u) +26
   Raven.Client.Connection.ReplicationInformer.TryOperation(Func`2 operation, OperationMetadata operationMetadata, OperationMetadata primaryOperationMetadata, Boolean avoidThrowing, T& result, Boolean& wasTimeout) +339
   Raven.Client.Connection.ReplicationInformer.ExecuteWithReplication(String method, String primaryUrl, OperationCredentials primaryCredentials, Int32 currentRequest, Int32 currentReadStripingBase, Func`2 operation) +474
   Raven.Client.Connection.ServerClient.ExecuteWithReplication(String method, Func`2 operation) +112
   Raven.Client.Connection.ServerClient.PutIndex(String name, IndexDefinition definition, Boolean overwrite) +117
   Raven.Client.Indexes.AbstractIndexCreationTask.Execute(IDatabaseCommands databaseCommands, DocumentConvention documentConvention) +83
   Raven.Client.DocumentStoreBase.ExecuteIndex(AbstractIndexCreationTask indexCreationTask) +43
   Raven.Client.Indexes.IndexCreation.CreateIndexes(ExportProvider catalogToGetnIndexingTasksFrom, IDocumentStore documentStore) +126
   Raven.Client.Indexes.IndexCreation.CreateIndexes(Assembly assemblyToScanForIndexingTasks, IDocumentStore documentStore) +78
   Acp.Production.WebUI.WebApiApplication.CreateRavenIndexes() +33
   Acp.Production.WebUI.WebApiApplication.Application_Start() +315

[HttpException (0x80004005): Unable to connect to the remote server]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9916673
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Unable to connect to the remote server]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9930568
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

In the configuration panel for the Azure website I have left everything with their defaults.

The Managed Pipeline mode is "Integrated"

I have double checked that the API key in RavenHQ is read/write.

Googling around, this error is because something else has taken the port.

I can't see in Azure WebSite if it is possible to create an endpoint for port:8888.

Do I override the port in my connection string to something else?

I have no real need for replication - the stack trace implies that the problem is something to do with replication.

I then disabled replication in RavenHQ, but I still get the same YSOD.

Any suggestions?

Many thanks in advance,
Jeremy

Oren Eini (Ayende Rahien)

unread,
Sep 16, 2014, 12:47:37 AM9/16/14
to ravendb
The issue isn't in Azure, you got the same error locally as well.
Do you have fiddler enabled? Or maybe in the .config file you have a proxy setting?



Oren Eini

CEO


Mobile: + 972-52-548-6969

Office:  + 972-4-622-7811

Fax:      + 972-153-4622-7811




--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jeremy Holt

unread,
Sep 16, 2014, 1:11:42 AM9/16/14
to rav...@googlegroups.com
Yes - I just saw that there was a default proxy in the web.config - no idea where it came from!

I changed it to the following and everything works fine now.

  <system.net>
    <defaultProxy useDefaultCredentials="true">
      
      <!--<proxy usesystemdefault="False" bypassonlocal="True" proxyaddress="http://127.0.0.1:8888" />-->
    </defaultProxy>
  </system.net>

Do I need to have a proxy in the web.config?

After having messed around for days in setting up a VM, looking at worker roles and goodness knows what else, the EASIEST way to set up a web site on Azure with Raven is:

a) Get a RavenHQ account
b) Create a website on Azure - stick the connection string from RavenHQ into the connection strings section of Config in the management portal
c) Deploy from Github.

It might be an idea to put this into the documentation somewhere. The whole set up takes about five minutes - if you know what you're doing. 

If you don't know what you're doing (that's me!!) it takes 7 days to get there!!!!

All credit to https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2397357-fix-it-so-that-net-apps-can-access-http-thru-auth for making me look for the proxy setting in the first place, Troy Hunt's article http://www.troyhunt.com/2014/01/with-great-azure-vm-comes-great.html which about half way down explains how to set the connection string in Azure and of course RavenHQ providing the connectionstring for a dumbass like me!


Thanks again
Jeremy

Oren Eini (Ayende Rahien)

unread,
Sep 16, 2014, 1:14:31 AM9/16/14
to ravendb
Jeremy, 
Would it be possible for you to record yourself going through those steps to show people how this is done on Video?



Oren Eini

CEO


Mobile: + 972-52-548-6969

Office:  + 972-4-622-7811

Fax:      + 972-153-4622-7811




Jeremy Holt

unread,
Sep 16, 2014, 1:39:32 AM9/16/14
to rav...@googlegroups.com
What - you mean me farting around for 7 days :) It would be a XXX rated video - lots of obscene language and violence!

Oren Eini (Ayende Rahien)

unread,
Sep 16, 2014, 1:41:42 AM9/16/14
to ravendb
I mean the 5 min version



Oren Eini

CEO


Mobile: + 972-52-548-6969

Office:  + 972-4-622-7811

Fax:      + 972-153-4622-7811




Oren Eini (Ayende Rahien)

unread,
Sep 16, 2014, 1:41:46 AM9/16/14
to ravendb
And let us keep it at least PG12



Oren Eini

CEO


Mobile: + 972-52-548-6969

Office:  + 972-4-622-7811

Fax:      + 972-153-4622-7811




Jeremy Holt

unread,
Sep 16, 2014, 2:04:36 AM9/16/14
to rav...@googlegroups.com
Sure - any suggestion as to what I should use to record the video - never done one of these.

Oren Eini (Ayende Rahien)

unread,
Sep 16, 2014, 2:08:24 AM9/16/14
to ravendb
Camtasia is great, and has a 30 days trial.
But honestly, join.me can do that pretty nicely too.




Oren Eini

CEO


Mobile: + 972-52-548-6969

Office:  + 972-4-622-7811

Fax:      + 972-153-4622-7811




Jeremy Holt

unread,
Sep 16, 2014, 8:44:29 PM9/16/14
to rav...@googlegroups.com
OK - I'll try to put this together over the weekend.
Reply all
Reply to author
Forward
0 new messages