From the stack trace it seems that there is some failure when it tries to create instance of VirtualPathProviders according to configuration in web.config. They are specified under setting <episerver.framework><virtualPathProviders> in web.config.
Do you have any provider that is from assembly EPiServer.Framework? If so change assembly to EPiServer.Framework.AspNet
Thanks Johan,
Already its updated during upgrade,
<virtualPathProviders> <clear /> <add name="ProtectedModules" virtualPath="~/EPiServer/" physicalPath="Modules\_Protected" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider, EPiServer.Framework.AspNet" /> <add name="CustomUrlMapping" type="EPiServer.Web.Hosting.VirtualPathMappedProvider, EPiServer" /> </virtualPathProviders>
Eventhough getting error.
This should be changed to EPiServer.Framework.AspNet instead
<add name="CustomUrlMapping" type="EPiServer.Web.Hosting.VirtualPathMappedProvider, EPiServer" />
Thanks Quan,
Its Worked. Updated code below,
<virtualPathProviders> <clear/> <add name="ProtectedModules" virtualPath="~/EPiServer/" physicalPath="Modules\_Protected" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider, EPiServer.Framework.AspNet"/> <add name="CustomUrlMapping" type="EPiServer.Web.Hosting.VirtualPathMappedProvider, EPiServer.Framework.AspNet"/> </virtualPathProviders>
But, Am not able to call the WebApi..
You might find the solution here https://stackoverflow.com/questions/19969228/ensure-that-httpconfiguration-ensureinitialized
Ya Quan, I tried that too in earlier, which you mentioned in above answer..
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); BundleConfig.RegisterBundles(BundleTable.Bundles); GlobalConfiguration.Configure(Infrastructure.ApiControllers.WebApiConfig.Register); RegisterGlobalFilters(GlobalFilters.Filters); GlobalConfiguration.Configuration.EnsureInitialized(); ////Tip: Want to call the EPiServer API on startup? Add an initialization module instead (Add -> New Item.. -> EPiServer -> Initialization Module) }
Eventhough getting error.
Commented that code like below,
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); BundleConfig.RegisterBundles(BundleTable.Bundles); //// GlobalConfiguration.Configure(Infrastructure.ApiControllers.WebApiConfig.Register); RegisterGlobalFilters(GlobalFilters.Filters); ////Tip: Want to call the EPiServer API on startup? Add an initialization module instead (Add -> New Item.. -> EPiServer -> Initialization Module) }
Instead of this, I Added that line in ConfigurationContainer method.
public void ConfigureContainer(ServiceConfigurationContext context) { context.StructureMap().Configure(ConfigureContainer); var dependencyResolver = new StructureMapDependencyResolver(context.StructureMap()); DependencyResolver.SetResolver(dependencyResolver); ////mvc GlobalConfiguration.Configuration.DependencyResolver = dependencyResolver; ////web api GlobalConfiguration.Configure(config => { WebApiConfig.Register(config); config.Services.Add(typeof(IExceptionLogger), new WebApiExceptionLogger()); }); }
Its working now. Is this Correct? Little bit worried for below thing,
Because
RegisterGlobalFilters(GlobalFilters.Filters);
Its registered in app_start but web api config called after this in dependencyresolverinitilization class .
Will it affect any other case ? Is that fine ?
Hi Team,
I used below code in dependencyResolver ,
public void ConfigureContainer(ServiceConfigurationContext context)
{
context.StructureMap().Configure(ConfigureContainer);
var dependencyResolver = new StructureMapDependencyResolver(context.StructureMap());
DependencyResolver.SetResolver(dependencyResolver); ////mvc
GlobalConfiguration.Configuration.DependencyResolver = dependencyResolver; ////web api
}
But I faced null exception. Below the Error StackTrace,
Stack Trace:
Its due to the Episerver Upgrade ( from 10.2.1 - to 11.9.2 ). I removed the old version of StructureMap too. Is there any configuration missed ? Kindly help me out.
Thanks in Advance.
Regards,
krishna.