System.TypeLoadException Upon Adding Page Flow

Topics: Web Client Software Factory
Feb 5, 2007 at 7:25 PM
I am attempting to create a project to get accustomed to the Page Flows. I have created a solution with a single Business Model and two views, using the Web Client Factory recipes. Upon adding the <pageFlow> and <httpModules> entries to the config file as stated in the documentation/Quick Start, I get the following exception before any page is displayed:

System.TypeLoadException: A null or zero length string does not represent a valid Type.

Stack Trace:
TypeLoadException: A null or zero length string does not represent a valid Type.
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +2717981
System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +58
System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +64
Microsoft.Practices.PageFlow.WorkflowFoundation.WorkflowFoundationPageFlowProvider..ctor(PageFlowInstanceStoreProviderSection pageFlowInstanceStoreProviderSection, PageFlowInstanceCorrelationTokenProviderSection pageFlowCorrelationTokenProviderSection) +204

TargetInvocationException: Exception has been thrown by the target of an invocation.
System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType) +0
System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType) +13
System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +366
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1036
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +114
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +23
Microsoft.Practices.PageFlow.PageFlowDirectory.BuildProvider() +297
Microsoft.Practices.PageFlow.PageFlowDirectory.get_Provider() +77
Microsoft.Practices.PageFlow.PageFlowHttpModule.ProcessRequest(HttpRequest request) +93
Microsoft.Practices.PageFlow.PageFlowHttpModule.OnPostAcquireRequestState(Object sender, EventArgs e) +55
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +167
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +117


If I comment out these two sections, the project loads fine. Any ideas?
Feb 6, 2007 at 2:53 PM
Can you show us your configuration file?

Thanks
Matias
http://staff.southworks.net/blogs/matiaswoloski
Feb 6, 2007 at 3:45 PM
Sure. It looks like the post is stripping out the indentation, so it's quite ugly...

<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="compositeWeb">
<section name="modules" type="Microsoft.Practices.CompositeWeb.Configuration.ModulesConfigurationSection, Microsoft.Practices.CompositeWeb"/>
<section name="authorization" type="Microsoft.Practices.CompositeWeb.Configuration.AuthorizationConfigurationSection, Microsoft.Practices.CompositeWeb"/>
</sectionGroup>
<section name="securityConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Security.Configuration.SecuritySettings, Microsoft.Practices.EnterpriseLibrary.Security, Version=2.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<sectionGroup name="pageFlow">
<section name="pageFlowProvider" type="Microsoft.Practices.PageFlow.Configuration.PageFlowProviderSection, Microsoft.Practices.PageFlow"/>
<section name="hostingWorkflowRuntime" type="System.Workflow.Runtime.Configuration.WorkflowRuntimeSection, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<section name="pageFlowInstanceStoreProvider" type="Microsoft.Practices.PageFlow.Configuration.PageFlowInstanceStoreProviderSection, Microsoft.Practices.PageFlow"/>
<section name="pageFlowInstanceCorrelationTokenProvider" type="Microsoft.Practices.PageFlow.Configuration.PageFlowInstanceCorrelationTokenProviderSection, Microsoft.Practices.PageFlow"/>
</sectionGroup>
</configSections>
<appSettings/>
<connectionStrings/>
<compositeWeb>
<modules>
<module name="Shell" assemblyName="Shell" virtualPath="~/"/>
</modules>
</compositeWeb>
<pageFlow>
<pageFlowProvider providerType="Microsoft.Practices.PageFlow.WorkflowFoundation.WorkflowFoundationPageFlowProvider, Microsoft.Practices.PageFlow.WorkflowFoundation"/>
</pageFlow>
<securityConfiguration defaultAuthorizationInstance="RuleProvider" defaultSecurityCacheInstance="">
<authorizationProviders>
<add type="Microsoft.Practices.EnterpriseLibrary.Security.AuthorizationRuleProvider, Microsoft.Practices.EnterpriseLibrary.Security, Version=2.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" name="RuleProvider">
<rules>
</rules>
</add>
</authorizationProviders>
</securityConfiguration>
<loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<listeners>
<add source="Enterprise Library Logging" formatter="Text Formatter" log="Application" machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" name="Formatted EventLog TraceListener"/>
</listeners>
<formatters>
<add template="Timestamp: {timestamp}&#xA;Message: {message}&#xA;Category: {category}&#xA;Priority: {priority}&#xA;EventId: {eventid}&#xA;Severity: {severity}&#xA;Title:{title}&#xA;Machine: {machine}&#xA;Application Domain: {appDomain}&#xA;Process Id: {processId}&#xA;Process Name: {processName}&#xA;Win32 Thread Id: {win32ThreadId}&#xA;Thread Name: {threadName}&#xA;Extended Properties: {dictionary({key} - {value}&#xA;)}" type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" name="Text Formatter"/>
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="Formatted EventLog TraceListener"/>
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events"/>
<notProcessed switchValue="All" name="Unprocessed Category"/>
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="Formatted EventLog TraceListener"/>
</listeners>
</errors>
</specialSources>
</loggingConfiguration>
<exceptionHandling>
<exceptionPolicies>
<add name="GlobalExceptionLogger">
<exceptionTypes>
<add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="None" name="Exception">
<exceptionHandlers>
<add logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling" formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=2.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" name="Logging Handler"/>
</exceptionHandlers>
</add>
</exceptionTypes>
</add>
</exceptionPolicies>
</exceptionHandling>
<system.web>
<compilation debug="true">
<assemblies>
<add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Configuration.Install, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="Microsoft.Build.Framework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
<authentication mode="Windows"/>
<customErrors mode="RemoteOnly">
<error statusCode="403" redirect="~/Errors/AccessDenied.htm"/>
</customErrors>
<siteMap defaultProvider="DefaultSiteMapProvider" enabled="true">
<providers>
<add name="DefaultSiteMapProvider" type="Microsoft.Practices.CompositeWeb.Providers.ModuleSiteMapProvider, Microsoft.Practices.CompositeWeb" securityTrimmingEnabled="true"/>
</providers>
</siteMap>
<pages styleSheetTheme="Default"/>
<httpModules>
<add name="WebClientAuthorizationModule" type="Microsoft.Practices.CompositeWeb.Authorization.WebClientAuthorizationModule, Microsoft.Practices.CompositeWeb"/>
<add name="ExceptionLoggerHttpModule" type="Microsoft.Practices.CompositeWeb.EnterpriseLibrary.ExceptionLogger, Microsoft.Practices.CompositeWeb.EnterpriseLibrary"/>
<add name="PageFlowModule" type="Microsoft.Practices.PageFlow.PageFlowHttpModule, Microsoft.Practices.PageFlow"/>
</httpModules>
</system.web>
</configuration>
Feb 6, 2007 at 5:59 PM
It looks to me like you're missing some of the page flow config sections... specifically the hostingWorkflowRuntimetype, pageFlowInstanceStoreProvider, and pageFlowInstanceCorrelationTokenProvider sections.

It sounds like you've found the section in the help named "How to: Enable your Solution for Page Flow", but you've missed the above sections from a copy-and-paste.

Does that help?

Simon
http://www.dotnetblogs.co.uk/
Feb 6, 2007 at 6:42 PM
Yes, that is exactly what I needed. Thank you.

John