我有一个用 Asp.net MVC 制作的网站,它安装在共享托管环境的根目录中。
现在,我已经在 Asp.net MVC 中为该网站制作了一个移动版本,并将其安装为子域http://m.price-tag.org http://m.price-tag.org它指向一个文件夹m(设置为虚拟目录)在根目录中。
当有人通过移动设备访问该网站时,会显示程序集限定名称错误,该错误会在刷新页面时消失。以下是 iPhone 模拟器的屏幕截图,显示相同的错误。即使在模拟器中,刷新页面时也会出现错误。
奇怪的是,错误中提到的类型是在我的主网站中使用的,而不是在移动网站中使用的。当我的移动项目完全不同并且有自己的 web.config 但不知何故,似乎使用了根的 web.config 时,为什么会发生这种情况?这可能是 web.config 问题吗
NOTE:- 两个项目都有自己的 EntityObject、模型和 Web.config 文件,并且它们之间不共享任何内容。
EDIT:- 此错误仅在移动设备中显示......而且也是第一次,如果刷新页面,它就会消失。
使用堆栈跟踪编辑
[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:无法为应用程序配置中指定的 DbContext 类型“PriceCompare.Models.PriceCompareEntity、PriceCompare”设置类型为“Disabled”的数据库初始值设定项。条目的格式应为 'key="DatabaseInitializerForType MyNamespace.MyDbContextClass, MyAssembly" value="MyNamespace.MyInitializerClass, MyAssembly"' 或 'key="DatabaseInitializerForType MyNamespace.MyDbContextClass, MyAssembly" value="Disabled"'。初始化类必须有一个无参数构造函数。有关详细信息,请参阅内部异常。]
System.Data.Entity.Internal.DatabaseInitializerConfig.ApplyInitializer() +383
System.Data.Entity.Internal.DatabaseInitializerConfig.ApplyInitializersFromConfig() +288
System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +59
System.Data.Entity.Internal.LazyInternalContext.b__4(InternalContext c) +7
System.Data.Entity.Internal.RetryAction1.PerformAction(TInput input) +118
System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action
1 个动作)+190
System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() +73
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(类型实体类型)+27
System.Data.Entity.Internal.Linq.InternalSet1.Initialize() +62
System.Data.Entity.Internal.Linq.InternalSet
1.get_InternalContext() +15
系统.数据.实体.基础设施.DbQuery1.System.Linq.IQueryable.get_Provider() +37
System.Linq.Queryable.OrderByDescending(IQueryable
1 来源、表达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个参数)+188
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContextcontrollerContext,ActionDescriptoractionDescriptor,IDictionary2 parameters) +27
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +56
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func
1 续)+267
System.Web.Mvc.c__DisplayClass17.b__14() +20
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContextcontrollerContext,IList1 filters, ActionDescriptor actionDescriptor, IDictionary
2个参数)+190
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContextcontrollerContext,字符串actionName)+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__DisplayClass81.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult
1.结束() +55
System.Web.Mvc.c__DisplayClasse.b__d() +31
System.Web.Mvc.SecurityUtil.b__0(操作 f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(操作操作)+23
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)+59
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult 结果) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8969117
System.Web.HttpApplication.ExecuteStep(IExecutionStep 步骤,布尔值&同步完成) +184