Connecting to multiple sites

Topics: Troubleshooting
Oct 11, 2011 at 8:48 PM
Edited Oct 11, 2011 at 9:11 PM

I'm having difficulty connecting to multiple domains from the same installation with the latest Betas using new Url Configuration Hostnames in System perspective.

I can browse to one domain which has been set up  in this manner, but no other domains will connect. Eventually the attempts time out with a message similar to "Could not ensue a global resource lock..." (See below).

I got the files via the web platform installer, for version:

Composite C1 3.0.0 (BETA 4 Internal build) Build no. 3.0.4297.23822 (last week's)

then initialized the install with a user and the Omnicorp demo. I added a second website, published it, then set up two hostnames for the sites in System→Url Configuration→Hostnames. I put the files on remote server and reasserted proper security settings. 

The hostname with domain matching the one used to reach Composite/Top.aspx can be browsed. Attempting to connect to the second defined hostname never finishes the connection. When the internal viewer is used, reached by right clicking on the second site in Content perspective and selecting "View published", the page is rendered as expected and the path appears correct, but the page won't show in regular browser.

Security, app pool, everything I can find is set up identically to a similar running installation of version

Composite C1 2.1.1 Build no. 2.1.4113.99

, with the old hostname procedures. Version 2.1.1 runs multiple sites fine, all as expected. But I can't get the 3.0Beta to browse to a second site.

Here is the timeout message:

 

Server Error in '/' Application.
Could not ensure a global resource lock within the specified timeout period.
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.Threading.WaitHandleCannotBeOpenedException: 
Could not ensure a global resource lock within the specified timeout period.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. 
To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. 
The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure 
that an application has debugging disabled before deploying into production scenario.

Stack Trace:

[WaitHandleCannotBeOpenedException: Could not ensure a global resource lock within the specified timeout period.]
   Composite.Core.Application.AppDomainLocker.EnsureLock(TimeSpan timeoutPeriod) +271
   Composite.Core.WebClient.ApplicationLevelEventHandlers.Application_Start(Object sender, EventArgs e) +143
   ASP.global_asax.Application_Start(Object sender, EventArgs e) +25

[HttpException (0x80004005): Could not ensure a global resource lock within the specified timeout period.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9160125
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +131
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253

[HttpException (0x80004005): Could not ensure a global resource lock within the specified timeout period.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9079228
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256

I think I must have a setting wrong somewhere or missed a step because I've read that others have gotten multi-site working, but I've tried this a few ways and times. Any guesses what I could try are welcome!

Oct 11, 2011 at 10:04 PM
Edited Oct 12, 2011 at 2:36 AM

Viewing the log of a misbehaving site I find entries like

Failed to obtain the lock for updating Composite.Generated.dll        Global.asax    Warning
10/11/2011 2:29 PM          The AppDomain (7) failed to obtain a mandatory lock on other AppDomains on key 'C1@c-inetpub-vhosts-DOMAINNAME-httpdocs-'        AppDomainLocker    Warning             10/11/2011 2:29 PM          The AppDomain (7) has stopped waiting for signal on key 'C1@c-inetpub-vhosts-DOMAINNAME-httpdocs-'. Continuing without syncronization...        AppDomainLocker

EDIT: Multiple domains won't render. A site restarted will accept the first domain used to visit the site, afterward no other domains will load. If an Url Config exists for the first domain used to visit the site, it is respected, otherwise display defaults to first page in content. I understand from another thread someone had this working, but I've been at it for a couple days, and have tried it all. It does not work with the Beta build I've got.

Coordinator
Oct 12, 2011 at 8:50 AM

Hi @xanderlih

The exception you see occurs only when the site is starting up, as you see the ASP.global_asax.Application_Start method in call stack.

It seems strange when that you have your site restarting after you access it from different hostnames. Possible explanations would be:

1) you either have some code specific to your solution that, f.e. raises an unhandled exception that leads to a site restart. Way to handle it would be to build debug versiotions of Composite.dll, and Composite.Workflow.dll, copy them to site's root, attach Visual Studio and see what the exception is.

2) it could be something to the way you host the solution, are you using WebMatrix+IISExpress, or IIS7?


Oct 12, 2011 at 5:00 PM
Edited Oct 13, 2011 at 7:57 PM

Hi, thanks for response! I've been working with files I got through the web platform installer, but the live installation uses IIS7.

At first I was trying to deploy a complex site I'd created and packaged, but in the end I was working with only the files that the Web Platform Installer downloaded from http://bit.ly/C1NightlyWebPI

Multiple-Url Configurations only take effect on a remote server. I have remote access to the server and full control, but actually developing on it does not sound practical.

I gather from your response that you believe the feature to work and my implementation to be in error, which could certainly be the case.

But I took the empty site structure, created a default template, a page type, added two sites to the content, set up the  hostnames, and could not view the second site. It could be a hosting environment setting somehow overlooked, it could be a bad copy of a beta build, but it is not code specific to my site because I haven't added any.

I'll consider trying to compile a debug version and testing it. I don't have any other ideas to go with. 

EDIT: I compiled debug dlls from latest files in Source Code section. Unfortunately I cannot attach VS2008 on the Server to the inetmgr process. When I attempt to it says I need to repair the 64 Bit Debugger in Add/Remove, but there is no such entry. I am not eager to start messing with the server more than that, because it works, and I have multi-domain C1 installations running successfully on it, just not any C1 version with the hostname and Url Configuration options.

What would I need to do to be able to work on this in a local environment? I'd have to set up the DNS info to direct a couple domains to my desktop somehow... 

FINAL EDIT: I am convinced this feature is not working as intended in the 3.0 Betas at the moment. Because they are not intended for deployment, being betas, maybe no one else has yet tried to actually browse two sites from the same installation at the same time. If anyone has had success with multiple hostnames and the Beta, please say so!

Coordinator
Oct 14, 2011 at 9:17 AM
Edited Oct 14, 2011 at 9:24 AM

Hi @xanderlih 

>> maybe no one else has yet tried to actually browse two sites from the same installation at the same time. If anyone has had success with multiple hostnames and the Beta, please say so!

Sorry for the late answer. I do, as I was assigned to develop that particular functionality, I'm running my local development copy and accessing it with 5 different hostnames, and it works well without problems for months. Our testing team had a lot of time to check all url/friendly url/redirects/hostnames-related functionality. There're some sites running on 3.0 beta without problems, and some of them using UrlConfiguration feature. On top of my mind is LogBuy developed by @burningice, one site instance is accessed by the following 2 hostnames, each one for a  different language

http://www.logbuy.dk/

http://www.logbuy.co.uk/

In order to have such a testing environment, you should edit the hosts file. It's located by path %SystemRoot%\system32\drivers\etc\hosts

Add a hostname, map it to 127.0.0.1 ip address, and if you restart the browser, it will be redirecting all hostname requests to your local machine. 

Here's a part of the  hosts file from mine machine, usually I have a host name mapped to each site I develop locally, as this way I don't have to remember port numbers:

127.0.0.1	test.local
127.0.0.1       test.localhost
127.0.0.1       patchtest.local
127.0.0.1       test2.localhost
127.0.0.1       www.test2.localhost
127.0.0.1       packages.local
127.0.0.1       sp2test.local
127.0.0.1       sp2test1.local
127.0.0.1       uidev.local
127.0.0.1       beta.local
127.0.0.1       stf.local
127.0.0.1       www.dr.local
127.0.0.1       dr.local
127.0.0.1       ua.dr.local
127.0.0.1       multisite
Oct 14, 2011 at 6:00 PM

Excellent, I'm glad to hear the functionality should be working. That has not been my experience.

Thanks for hosts file tip.

Oct 14, 2011 at 7:14 PM

Success!

Hosting environment issue. 

In the past, with umbraco and earlier versions of Composite C1, when running additional sites from the same installation, I would use the Plesk panel or IIS7 to actually add another website, which would have the same root directory as the original. I do not know if this is the wrong way to do it, but it has always worked.

Composite C1 does not appear to expect this particular approach any longer. Instead, I used Plesk to add a Domain Alias to the first site (not another website to the directory, but another hostname to the site).

Thanks for responding with tips and ideas; working the local hosts file changes into IIS7 showed me the way!

Oct 14, 2011 at 7:20 PM
Edited Oct 14, 2011 at 7:20 PM

You should never have several websites/application pointing to the same folder and database. It might seem to work at first, but you're just asking for trouble with caching and possible data corruption and race-conditions. Ie. what should happen if two editors, sitting on each of the different sites saving the same page at the same time. When you have several applications, unaware of each other, pointing to the same datastore and configurations you'll just end up with the last one to save being the winner and rest of the data is lost.

Just don't do it. Not with umbraco either.

Oct 15, 2011 at 2:34 AM

Good to know!