Parser Error with IIS, but not Development Server?

Topics: Troubleshooting
Jan 17, 2012 at 10:13 PM

Hi guys, why is it that when I run Orchard 1.3.10 'full source' in VS2010 using ‘Visual Studio Development Server’ everything functions as expected, but when I run the same project from VS using ‘Local IIS web server’, I get several errors e.g.


Parser Error Message: Error compiling module "itWORKS.ExtendedRegistration" from file "/OrchardLocal/Modules/itWORKS.ExtendedRegistration/itWORKS.ExtendedRegistration.csproj":
The assembly reference 'Orchard.Users' could not be loaded.

There are generally a few ways to solve this issue:
1. Remove the assembly reference from the project file if it's not needed.
2………etc.


The above error also occurs with Advanced Menu Module?

Thanks in anticipation, Cheers Dyr

Coordinator
Jan 17, 2012 at 10:23 PM

What happens when you build the solution? Did you add that project to the solution?

Jan 17, 2012 at 11:00 PM

Hmm, still getting my head around orchard [kind of hard when you’re a designer]…so I added the aforementioned Modules Project’s causing the errors [from Orchard.Web / Modules] into the main Orchard solution's Modules folder – is that correct? Anyhow, the errors disappeared but are now replaced with:


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: Autofac.Core.DependencyResolutionException: None of the constructors found with policy 'Orchard.Environment.AutofacUtil.DynamicProxy2.ConstructorFinderWrapper' on type 'Orchard.Security.Authorizer' can be invoked with the available services and parameters:
Constructor 'Void .ctor(Orchard.Security.IAuthorizationService, Orchard.UI.Notify.INotifier, Orchard.IWorkContextAccessor)' parameter resolution failed at parameter 'Orchard.Security.IAuthorizationService authorizationService'.

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.

 

Stack Trace:

 

[DependencyResolutionException: None of the constructors found with policy 'Orchard.Environment.AutofacUtil.DynamicProxy2.ConstructorFinderWrapper' on type 'Orchard.Security.Authorizer' can be invoked with the available services and parameters:

Constructor 'Void .ctor(Orchard.Security.IAuthorizationService, Orchard.UI.Notify.INotifier, Orchard.IWorkContextAccessor)' parameter resolution failed at parameter 'Orchard.Security.IAuthorizationService authorizationService'.]

    Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +578

    Autofac.Core.Resolving.ComponentActivation.Activate(IEnumerable`1 parameters) +89

   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +122

    Autofac.Core.Resolving.ComponentActivation.Execute(IEnumerable`1 parameters) +255

    Autofac.Core.Resolving.ResolveOperation.Resolve(ISharingLifetimeScope activationScope, IComponentRegistration registration, IEnumerable`1 parameters) +246

    Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +92

    Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +321

  Autofac.Core.Resolving.ComponentActivation.Activate(IEnumerable`1 parameters) +89

    Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +122

    Autofac.Core.Resolving.ComponentActivation.Execute(IEnumerable`1 parameters) +255

    Autofac.Core.Resolving.ResolveOperation.Resolve(ISharingLifetimeScope activationScope, IComponentRegistration registration, IEnumerable`1 parameters) +246

    Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +92

   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +321

    Autofac.Core.Resolving.ComponentActivation.Activate(IEnumerable`1 parameters) +89

    Autofac.Core.Resolving.ComponentActivation.Execute(IEnumerable`1 parameters) +141

    Autofac.Core.Resolving.ResolveOperation.Resolve(ISharingLifetimeScope activationScope, IComponentRegistration registration, IEnumerable`1 parameters) +246

    Autofac.Core.Lifetime.LifetimeScope.Resolve(IComponentRegistration registration, IEnumerable`1 parameters) +276

    Autofac.ResolutionExtensions.TryResolve(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +120

    Orchard.Mvc.OrchardControllerFactory.TryResolve(WorkContext workContext, Object serviceKey, T& instance) in F:\Downloads\_SOFTWARE\_programming\Orchard\Orchard.Source.1.3.10 - Copy\src\Orchard\Mvc\OrchardControllerFactory.cs:26

    Orchard.Mvc.OrchardControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) in F:\Downloads\_SOFTWARE\_programming\Orchard\Orchard.Source.1.3.10 - Copy\src\Orchard\Mvc\OrchardControllerFactory.cs:71

    System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +93

    System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +346

    System.Web.Mvc.<>c__DisplayClass6.<BeginProcessRequest>b__2() +71

    System.Web.Mvc.<>c__DisplayClassb`1.<ProcessInApplicationTrust>b__a() +19

    System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Func`1 func) +161

    Orchard.Mvc.Routes.HttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) in F:\Downloads\_SOFTWARE\_programming\Orchard\Orchard.Source.1.3.10 - Copy\src\Orchard\Mvc\Routes\ShellRoute.cs:143

    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +405

    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375


Thanks for your speedy initial reply 'bertandleroy', hope I haven't begun an erroneous remedy? Any suggestions will be greatly appreciated. Thanks again Dyr

Coordinator
Jan 17, 2012 at 11:24 PM

I'm suspecting that your local IIS is not configured for .NET 4.0. Then again, why do you want to run it in local IIS?

Coordinator
Jan 17, 2012 at 11:26 PM

also, restart IIS when that happens.

Jan 17, 2012 at 11:28 PM

It is running 4.0 [double checked], and I wish to use local IIS so I can expose the site for PayPal Sandbox testing.  Any other thoughts? Cheers Dyr

Jan 17, 2012 at 11:58 PM

hmm, just been experimenting with a fresh Orchard site - no additional modules added etc., and sure enough, IIS works.  Would this lead us to believe a third party module maybe the culprit?  I'm being very presumptuous, but I note 'Advanced Menu' pop's up in 'bug' like situations in many posts and I have had issues with it before. Thanks for any thoughts you may have, Cheers Dyr.

Jan 18, 2012 at 12:10 AM

Add modules one at a time until you get the error.

Jan 18, 2012 at 12:12 AM
dyrgutt wrote:

It is running 4.0 [double checked], and I wish to use local IIS so I can expose the site for PayPal Sandbox testing.  Any other thoughts? Cheers Dyr

You can always simulate the PayPal response locally using a WebRequest or whatever, but yeah it's a bit fiddly and you're best if you can expose the website to the internet somehow.

Jan 18, 2012 at 2:04 AM

Cheers randompete – wow! How very frustrating, I recreated my project adding modules one by one and re-compiling between each stage, and of course, everything works and not one error? […typical]. The only thing I did differently [and I’m very confident about this - as I’ve been keeping a log of operations] was to ‘run’ and ‘create’ my project via IIS from the start. The older project still won’t run [after trying all suggested remedies] and it annoys me that I don’t know why? This may go a little off topic, but I noticed a logging function ‘Orchard.Framework [logging] Ilogger’ – how would one implement such services in a module [example code would be great or a pointer to a tutorial on such] that I could log different areas reached in suspect modules during runtime. Anyhow, it appears I will most likely drop the old project and continue with the new recreated one. Thanks for all your help guys, very much appreciated. Cheers Dyr

Coordinator
Jan 18, 2012 at 2:07 AM

You can find logs in app_data\logs.

Jan 18, 2012 at 2:19 AM
Edited Jan 18, 2012 at 2:19 AM

Cheers bertandleroy, but I was hoping I could add

_logger.Information("Made it through first if statement");

_logger.Information("Made it to second if statement");  etc.

within modules. Any thoughts? Thanks again

Coordinator
Jan 18, 2012 at 2:49 AM

Sure: inject an ILogger and party on. There are plenty of examples of that throughout the code.

Jan 18, 2012 at 2:58 AM

Seeing these kinds of error normally means something isn't properly compiled, you can try doing a full clean/rebuild in Visual Studio, or even running the ClickToBuild.cmd in the Orchard source root (but it runs for a long time because it also performs all tests).

Coordinator
Jan 18, 2012 at 3:01 AM

build "compile;package" is a better alternative to clicktobuild because it doesn't run tests.

Jan 18, 2012 at 8:32 PM

Thankyou very much for all your help guys, I'll give it a shot. Cheers Dyr

Mar 26, 2013 at 6:59 AM
what do you do when this happens on production server, after installing a new module or version upgrade?
Coordinator
Mar 26, 2013 at 7:07 AM
Since you only deploy properly compiled packages onto the production server, and you run in precompiled mode, how can this happen? What errors exactly are you seeing?