Change Base Url

Topics: Administration
Sep 18, 2013 at 3:03 AM
I have new orchard website hosted on azure website. I have installed using http://mydomain.azurewebsites.net and then wanna to change the base url to http://www.mydomain.com. I'm go to Settings page on Dashboard, and change base url to mydomain.com. I got message "The base url you entered could not be requested from current location.".
I have experience with DNN that simply to add portal alias to the portal. How to change base url in Orchard?
Coordinator
Sep 18, 2013 at 7:15 PM
That's an Azure question, not really an Orchard question. You need to point the DNS entry for www.mydomain.com to the IP for your server.
Aug 16 at 11:28 AM
Edited Aug 16 at 11:30 AM
Actually, although that error could be obtained by entering a base URL value that was invalid - it also occurs if the URL is valid, and the site is using Sql Server with the default Read Committed isolation level.

In this case, the application creates a transaction and performs the Site Settings updates to set the new BaseURL - and then makes a new HttpRequest to the new URL which, if it's the tenant you're currently browsing to anyway, goes off and gets the Site settings - which are already locked because the first transaction hasn't completed yet...

The solution is to either 1) Change the behaviour by changing the transaction isolation level in the Sites.config file - and/or using Snapshot Isolation at the database level or 2) in the following code from SiteSettingsPartDriver, ensure that the current database transaction is committed before executing the HttpRequest:
 // if the base url has been modified, try to ping it
                    else if (!String.Equals(previousBaseUrl, model.Site.BaseUrl, StringComparison.OrdinalIgnoreCase)) {
                        try {
                            var request = WebRequest.Create(model.Site.BaseUrl) as HttpWebRequest;
                            if (request != null) {
                                using (request.GetResponse() as HttpWebResponse) { }
                            }
                        }
                        catch (Exception ex) {
                            if (ex.IsFatal()) {
                                throw;
                            }
                            _notifier.Warning(T("The base url you entered could not be requested from current location."));
                            Logger.Warning(ex, "Could not query base url: {0}", model.Site.BaseUrl);
                        }
                    }