Unable to deploy latest Azure build to dev fabric

Dec 16, 2010 at 1:29 AM

I am trying to deploy the latest source code drop 9297aacb96ba to the development fabric on my machine.  The code compiles and deploys ok,  but when I try to access the website I get the following exception:

Server Error in '/' Application.

Could not load file or assembly 'Lucene' or one of its dependencies. An attempt was made to load a program with an incorrect format.

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.BadImageFormatException: Could not load file or assembly 'Lucene' or one of its dependencies. An attempt was made to load a program with an incorrect format.

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.


Assembly Load Trace: The following information can be helpful to determine why the assembly 'Lucene' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


Stack Trace: 

[BadImageFormatException: Could not load file or assembly 'Lucene' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +39
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +132
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +144
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException: Could not load file or assembly 'Lucene' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +618
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +209
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
   System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +94
   System.Web.Compilation.BuildManager.CallPreStartInitMethods() +332
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +591

[HttpException (0x80004005): Could not load file or assembly 'Lucene' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8950644
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

I have had this with previous dev source code drops, but assumed at the time that something might have been broken.  I have also seen this throw the same error for the Orchard.Azure assembly on a different occasion.

Any help would be appreciated.

Cheers

Sam

Jan 16, 2011 at 2:12 AM

I am have just tried to deploy a build of the 1.0 source to the local dev fabric and have run into the same problem again.  Can anyone provide any suggestions as to what is going on??  I am want to upgrade my website to 1.0,  but if I can't make it work on the dev fabric then I am reluctant to try deploying to Azure.

 

Chers

Sam

Coordinator
Jan 16, 2011 at 3:38 AM

Yes, it doesn't work using the Visual Studio solution, because the build script is the only to be able to gather all needed files and configuration.

Though, once built using the build command, you should be able to use csrun to execute the package.

Jan 16, 2011 at 3:50 AM

That is exactly what I did.  I downloaded the release source code bundle, and then obtained the build files from the source repository (because they are not in the zip file for some reason), and ran ClickToBuildAzurePackage.cmd.  It built ok (other than a warning about using an old package definition format).  Deployed the built code to the dev fabric using csrun, and then tried to access the web page.  That is when the exception occurred.

Coordinator
Jan 20, 2011 at 9:54 PM

I just went through the whole process just to be sure, and it just works for me …
I have downloaded the source code from codeplex, clicked ClickToBuildOnAzure, then uploaded and it worked. Then I have added a module by copy/pasting in /Modules, opened the project and added a reference to it. Alos added a Theme. ClickToBuildOnAzure, upgrade the production instance on Azure … and it works:
http://orchard1.cloudapp.net/

I will document all those steps in the documentation. May you try it again, and if something is still wrong contact me directly so I can find out why, and add some more documentations.

Jan 29, 2011 at 1:05 AM

Ok.

So I have just downloaded the Orchard.Azure.1.0.20.zip from the main downloads page and deployed it to Azure.  And it seemed to deploy ok. I went to the main URL, configured the database connection string etc and it gave me the default home page. So far so good.

I then enabled the multi-tenancy feature (because I host a number of sites). Added another tenant.  I tried to go to the tenant site to go through the setup, and got the following error:

Server Error in '/' Application.

Object reference not set to an instance of an object.

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.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 


Source File: e:\approot\_WASR_\0\Themes\SafeMode\Views\Document.cshtml    Line: 17 

Stack Trace: 



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

Line 15:      @*Model.Zones.AddRenderPartial("head:before", "HeadPreload", Model);*@
Line 16:      @*Html.Zone("head", ":metas :styles :scripts"); %>*@
Line 17:      @Display(Model.Head)
Line 18:     <script>(function(d){d.className="dyn "+d.className.substring(7,d.length);})(document.documentElement);</script> 
Line 19: </head> 
[NullReferenceException: Object reference not set to an instance of an object.]
   Orchard.Core.Shapes.CoreShapes.Metas(TextWriter Output) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard.Web\Core\Shapes\CoreShapes.cs:206

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +639
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38
   Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy.ShapeAttributeBindingStrategy.PerformInvoke(DisplayContext displayContext, MethodInfo methodInfo, Object serviceInstance) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Descriptors\ShapeAttributeStrategy\ShapeAttributeBindingStrategy.cs:65
   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:55
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:161
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:74
   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:71
   ClaySharp.<>c__DisplayClass10.<InvokeMember>b__d() +52
   ClaySharp.ClayBehaviorCollection.Execute(Func`1 proceed, Func`3 linker) +32
   Orchard.Core.Shapes.CoreShapes.DocumentZone(Object Display, Object Shape, TextWriter Output) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard.Web\Core\Shapes\CoreShapes.cs:150

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +639
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38
   Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy.ShapeAttributeBindingStrategy.PerformInvoke(DisplayContext displayContext, MethodInfo methodInfo, Object serviceInstance) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Descriptors\ShapeAttributeStrategy\ShapeAttributeBindingStrategy.cs:65
   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:55
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:161
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:74
   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:71
   ClaySharp.<>c__DisplayClass10.<InvokeMember>b__d() +52
   ClaySharp.ClayBehaviorCollection.Execute(Func`1 proceed, Func`3 linker) +32
   ASP._Page_Themes_SafeMode_Views_Document_cshtml.Execute() in e:\approot\_WASR_\0\Themes\SafeMode\Views\Document.cshtml:17
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +103
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +173
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +147
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy.Render(ShapeDescriptor shapeDescriptor, DisplayContext displayContext, HarvestShapeInfo harvestShapeInfo, HarvestShapeHit harvestShapeHit) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:120
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.<>c__DisplayClass26.<Discover>b__14(DisplayContext displayContext) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:109
   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:55
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:161
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:83
   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:71
   ClaySharp.<>c__DisplayClass10.<InvokeMember>b__d() +52
   ClaySharp.ClayBehaviorCollection.Execute(Func`1 proceed, Func`3 linker) +32
   Orchard.Mvc.ViewEngines.ThemeAwareness.<>c__DisplayClass7.<FindView>b__5(ViewContext viewContext, TextWriter writer, IViewDataContainer viewDataContainer) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\Mvc\ViewEngines\ThemeAwareness\LayoutAwareViewEngine.cs:58
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +380
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +33
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +263
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +691
   System.Web.Mvc.Controller.ExecuteCore() +162
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +305
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
   Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in c:\Users\sebros\My Projects\ORchard Clean\src\Orchard\Mvc\Routes\ShellRoute.cs:155
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +453
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371

 

I'm not sure if this is related to the other problems I've been having with Azure, or something else.

Cheers

Sam

Feb 4, 2011 at 11:31 PM

Ok.  Some time later (days) I went back to try to setup the tenant again, and it worked.  The only thing I can think of is that the app pool recycled in the interim.  As to why it is failing initially, and then succeeding later, with no changes being made,   I have no idea.  

Any ideas??