Strange assembly name Error visiting the site from mobile phones

I have a website created in Asp.net MVC that is installed in the root directory of a shared hosting environment.

Now I made a mobile version for this site in Asp.net MVC and installed it as a subdomain of http://m.price-tag.org which points to the m folder (installed as a virtual directory) in the root directory.

When someone visits the site from a mobile device, an assembly name verification error is displayed, which turns off when the page is refreshed. Below is a screen shot for the iPhone emulator that displays the same error. Even in the emulator, an error occurs when the page is refreshed.

enter image description here

The strange part is that the type mentioned in the error is used on my main website, and not on the mobile site. Why does this happen when my mobile project is completely different and has its own web.config, but somehow it seems that root web.config is being used? This may be a problem with web.config.

NOTE : - Both projects have their own EntityObject, Models and Web.config files, and there is nothing between them.

EDIT : - This error is displayed only on mobile devices ..... And this is too first time if you refresh the page, it goes away.

EDIT using stack trace

[InvalidOperationException: The type 'PriceCompare.Models.PriceCompareEntity, PriceCompare' could not be found. The type name must be an assembly-qualified name.] System.Data.Entity.Internal.DatabaseInitializerConfig.ApplyInitializer() +315 

[InvalidOperationException: Failed to set the database initializer of type "Disabled" for type DbContext "PriceCompare.Models.PriceCompareEntity, PriceCompare" specified in the application configuration. Entries should be in the form "key =" DatabaseInitializerForType MyNamespace.MyDbContextClass, MyAssembly "value =" MyNamespace.MyInitializerClass, MyAssembly "'or' key =" DatabaseInitializerForType MyNamespace.MyDbContextClass, MyAssembly "constructor must have a constructor value =". . For more information, see Internal Exception.] System.Data.Entity.Internal.DatabaseInitializerConfig.ApplyInitializer () +383 System.Data.Entity.Internal.DatabaseInitializerConfig.ApplyInitializersFromConfig () +288 System.Data.Entity.Internal.Intalal.nternalinaliternital.ernaliternaliternaliternaliternaliternaliternaliternalinterface ) +59 System.Data.Entity.Internal.LazyInternalContext.b__4 (InternalContext c) +7 System.Data.Entity.Internal.RetryAction 1.PerformAction(TInput input) +118 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action 1 action) +190 System.Data.Entity.Int ernal.LazyInternalContext.InitializeDatabase () +73 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType (Type entityType) +27 System.Data.Entity.Internal.Linq.InternalSet 1.Initialize() +62 System.Data.Entity.Internal.Linq.InternalSet 1.get_InternalContext () +15 System.Data.Entity.Infrastructure.DbQuery 1.System.Linq.IQueryable.get_Provider() +37 System.Linq.Queryable.OrderByDescending(IQueryable 1 source, expression 1 keySelector) +66 PriceMobile.Controllers.HomeController.Index() in HomeController.cs:19 lambda_method(Closure , ControllerBase , Object[] ) +40 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary 2 parameters) +188 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod (ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary 2 parameters) +27 System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +56 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func 2 parameters) +27 System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +56 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func 1 continued) +267. <> c__DisplayClass17.b__14 () +20 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters (ControllerContext controllerContext, IList 1 filters, ActionDescriptor actionDescriptor, IDictionary 2 parameters) +190 System.Web.Mvc.ControllerActionContextonector Controller ) +329 System.Web.Mvc.Controller.ExecuteCore () +115 System.Web.Mvc.ControllerBase.Execute (RequestContext requestContext) +93 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute (RequestContext requestContext) +10 System.Web.Mvc. <> c__DisplayClassb.b__5 () +37 System.Web.Mvc.Async. <> c__DisplayClass1.b__0 () +21 System.Web.Mvc.Async. <> c__DisplayClass8 1.<BeginSynchronous>b__7(IAsyncResult _) +12 System.Web.Mvc.Async.WrappedAsyncResult 1.End () +55 System.Web.Mvc. <> c__DisplayClasse.b__d () +31 System.Web.Mvc.SecurityUtil.b__0 (Action f) +7 System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust (action) +23 System.Web.Mvc.MvcHandler.EndProcessRequest (IAsyncResResultCresResResultResRes ) +59 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest (result of IAsyncResult) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute () +8969111. (step IExecutionStep, Boolean & completed synchronously) +184

0
source share
4 answers

You need to use inheritInChildApplications so that the application inside the subdirectory does not use the root application configuration. See this for more details.

You cannot use the location tag in the appSettings section. Therefore, configurations that use a key / value pair, you must use the clear tag in the child directories of web.config

+1
source

Virtual directories / applications inherit the root web.config file by default. We can stop this behavior by having

 <location path="." inheritInChildApplications="false"> 

in root web.config

Please visit for more information.

+2
source

Something in common - PriceCompareEntity should be. I had a similar problem. I included the DLL in one project that referenced another that I did not consider necessary. The site failed with a similar error for the type in the specified DLL.

0
source

Two possibilities: 1) PriceCompare is not only the namespace and dll name, but also a name of some type. This system is confused by this homonym. Try changing either the type name or the name of both the dll and namespace. 2) the website cannot find PriceCompare dll with the correct version. This can happen because some part of the system belongs to the old version of this DLL. Only one of the two dlls is running, so one of the two links is not running. Clean your project to solve this problem.

0
source

All Articles