cassette icon indicating copy to clipboard operation
cassette copied to clipboard

Root Element is missing

Open ddysart opened this issue 9 years ago • 5 comments

I'm getting the following error on only one server in a load balance pool:

[XmlException: Root element is missing.]
   System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res) +189
   System.Xml.XmlTextReaderImpl.ParseDocumentContent() +513
   System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options) +58
   Cassette.Aspnet.WebHostSettingsConfiguration.IsStaticCacheManifest(CassetteSettings settings) +218
   Cassette.Aspnet.WebHostSettingsConfiguration.Configure(CassetteSettings settings) +249
   Cassette.ConfigurationEnumerableExtensions.Configure(IEnumerable`1 configurations, T configurable) +176

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +281
   Cassette.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) +873

[TinyIoCResolutionException: Unable to resolve type: Cassette.CassetteSettings]
   Cassette.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) +1241
   Cassette.TinyIoC.SingletonFactory.GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options) +165
   Cassette.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) +1296
   Cassette.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) +730

[TinyIoCResolutionException: Unable to resolve type: Cassette.BundleCollection]
   Cassette.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) +1049
   Cassette.TinyIoC.SingletonFactory.GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options) +165
   Cassette.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) +1296
   Cassette.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) +730

[TinyIoCResolutionException: Unable to resolve type: Cassette.Views.BundlesHelper]
   Cassette.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) +1049
   Cassette.TinyIoC.SingletonFactory.GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options) +165
   Cassette.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) +1296
   System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +248
   System.Linq.<CastIterator>d__b1`1.MoveNext() +296
   Cassette.HostBase.RunStartUpTasks() +248
   Cassette.HostBase.Initialize() +374
   Cassette.Aspnet.CassetteHttpModule.InitWithTraceLogging() +158
   Cassette.Aspnet.CassetteHttpModule.Init(HttpApplication httpApplication) +188
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +530
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): Unable to resolve type: Cassette.Views.BundlesHelper]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12968244
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12807949

The code and config was mirrored off of another server that is working. Looking at the stack trace, I thought to check that the <cassette> configuration element was in the web.config. The server is 2008 R2, .NET 4.5.1

There seem to be a few other issues related to this, but they all seem closed as of 2.4.1.

ddysart avatar Aug 01 '14 21:08 ddysart

Very odd. I'd try switching away from Cassette's default use of Isolated Storage for the bundle cache, and try using a normal directory. In web.config:

<cassette cacheDirectory="cassette-cache"/>

This can be an absolute path, or relative to the web application's root. Make sure the app pool identity has write permission.

andrewdavey avatar Aug 03 '14 11:08 andrewdavey

Tried that and it didn't seem to make a difference, the app pool identity has full control of the webroot. I've tried to compare as many of the app pool settings as possible and don't see any differences. Could the fact that we register a bundle modifier make a difference at all?

ddysart avatar Aug 04 '14 21:08 ddysart

Take a look at the XML file generated in the cache directory. I wonder if some its getting corrupted when written. Does more than one web server share the directory?

andrewdavey avatar Aug 05 '14 14:08 andrewdavey

No files are being generated in the cache directory. There is only one site using that directory for the root.

I'm not ruling out server config since the other server in the load balance pool is working fine, but beyond directory permission, I can't think of what else it could be.

ddysart avatar Aug 05 '14 15:08 ddysart

I as having the same problem. I updated my web.config to

And the site is now loading. Thanks for the help!

jouimet avatar Feb 10 '15 22:02 jouimet