Unable to find the requested .Net Framework Data Provider.
다음과 같은 오류가 발생한다면?
Unable to find the requested .Net Framework Data Provider. It may not be installed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.]
System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +109
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name) +468
System.Data.Entity.Internal.LazyInternalConnection.Initialize() +70
System.Data.Entity.Internal.LazyInternalConnection.get_ConnectionHasModel() +16
System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +226
System.Data.Entity.Internal.InternalContext.Initialize() +21
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +20
System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +92
System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +21
System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +44
System.Linq.Queryable.OrderByDescending(IQueryable`1 source, Expression`1 keySelector) +81
MvcMusicStore.Controllers.HomeController.GetTopSellingAlbums(Int32 count)
MvcMusicStore.Controllers.HomeController.Index()
lambda_method(Closure , ControllerBase , Object[] ) +79
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +249
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
...[생략]...
와중에 web.config의 연결 문자열이 sdf 파일을 가리키고 있다면?
...[생략]...
<connectionStrings>
<add name="MusicStoreEntities"
connectionString="Data Source=|DataDirectory|MvcMusicStore.sdf"
providerName="System.Data.SqlServerCe.4.0"/>
</connectionStrings>
...[생략]...
아마도 SQL Server Compact Edition 4.0이 설치돼 있지 않아서 발생하는 오류일 것이므로,
Microsoft® SQL Server® Compact 4.0 SP1
; https://www.microsoft.com/en-us/download/details.aspx?id=30709
SSCERuntime_x64-ENU.exe를 실행해 해결할 수 있습니다.
혹시나 그래도 이런 오류가 발생한다면?
[SqlCeException (0x80004005): Access to the database file is not allowed. [ 1914,File name = C:\MvcStore\App_Data\MvcMusicStore.sdf,SeCreateFile ]]
System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent) +2288
System.Data.SqlServerCe.SqlCeConnection.Open() +510
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +70
[EntityException: The underlying provider failed on Open.]
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +261
System.Data.EntityClient.EntityConnection.Open() +135
System.Data.Objects.ObjectContext.EnsureConnection() +84
System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +71
System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +49
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +220
System.Linq.Queryable.FirstOrDefault(IQueryable`1 source) +314
System.Data.Entity.Internal.InternalContext.QueryForModelHash() +242
System.Data.Entity.Internal.InternalContext.CompatibleWithModel(Boolean throwIfNoMetadata) +106
System.Data.Entity.DropCreateDatabaseIfModelChanges`1.InitializeDatabase(TContext context) +305
System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +64
[DataException: An exception occurred while initializing the database. See the InnerException for details.]
System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +152
System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +182
System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +193
System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +217
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +20
System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +92
System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +21
System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +44
System.Linq.Queryable.OrderByDescending(IQueryable`1 source, Expression`1 keySelector) +81
MvcMusicStore.Controllers.HomeController.GetTopSellingAlbums(Int32 count)
MvcMusicStore.Controllers.HomeController.Index()
lambda_method(Closure , ControllerBase , Object[] ) +79
...[생략]...
오류 메시지 그대로 권한이 없는 경우인데요, 탐색기에서 MvcMusicStore.sdf 파일의 권한 체크를 해보시고 IIS의 AppPool 권한과 비교하면 답이 나올 것입니다.
[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]