我有一個在Asp.net MVC中製作的網站,它安裝在共享主機環境的根目錄下。奇怪的程序集名稱從手機訪問網站時出錯
現在,我已經作出了移動版本用於此網站在Asp.net MVC和安裝了它作爲一個子域http://m.price-tag.org其指向在根目錄中的文件夾米(設定爲虛擬目錄)。
當某人從移動設備訪問該站點時,會顯示一個程序集限定名稱錯誤,該頁面在刷新頁面時會消失。以下是顯示相同錯誤的iPhone模擬器屏幕截圖。即使在模擬器中,頁面刷新時也會出現錯誤。
奇怪的是,在錯誤中提到的類型在我的主網站上使用,而不是移動網站。爲什麼會發生這種情況,當我的移動項目是完全不同的,並有自己的web.config但不知何故,似乎使用根的web.config?可這是一個web.config問題
注意: - 這兩個項目都有自己的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' 在應用配置中指定。條目的格式應爲'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.RetryAction 1.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(Type entityType)+27 System.Data.Entity.Internal.Linq.InternalSet 1.Initialize() +62 System.Data.Entity.Internal.Linq.InternalSet
1.get_InternalContext()+15 Syst em.Data.Entity.Infrastructure.DbQuery 1.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(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
1續)267 System.Web.Mvc 。 <> c__DisplayClass17.b__14()20個 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext,IList的1 filters, ActionDescriptor actionDescriptor, IDictionary
2參數)190 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext,字符串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__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(動作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
請參閱此鏈接http://www.asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc245724860 – user960567 2012-02-11 10:01:38
不,不是這種情況....兩個應用程序都是Asp.net 4.0 – 2012-02-11 18:45:21
你試過了,在這個鏈接中inheritInChildApplications?請至少閱讀一次。 – user960567 2012-02-12 06:07:57