Cannot Deploy MVC 3 Project with Entity Framework 4.3.1 and Oracle ODAC

非 Y 不嫁゛ 提交于 2019-12-02 09:04:47

问题


I'm currently trying to deploy a MVC 3 application I've been working on to our test web server, and am running into a major problem with loading everything correctly. To try and give as much info about this as possible, I'm doing a bin deploy (I've sent all references to copy locally), and am doing a basic Publish on the web project via file system to the application directory on the server. The components I'm using are:

Entity Framework 4.3.1 Oracle ODAC 11.2.0 (version 4.112.3.0)

This application has 2 Entity Framework objects, one going to a SQL Server database and the other going to an Oracle 10g database. I believe the issue is with the Entity Framework object going to the Oracle database. This is my first MVC 3 project and my first deployment (there's a lot of "new" variables here), so I'm not sure if I'm missing anything or not. How do I fix this issue? Everything works perfectly fine on my local machine, it's only when I deploy the project to the server, that I have problems.

Things I've tried so far:

All of my controllers inherit from a base controller (BaseController), where the instances of the entity framework objects live. I cannot get to the Index view of any controller that inherits from the BaseController, but the HomeController inherits from Controller. This page works correctly. I've tried inheriting from Controller in the others, and that allows me to get to the Index view, but going back to BaseController causes the errors in the stack trace again. The error appears to happen on the line where I'm declaring my entity framework object going to the oracle database:

protected internal RadixWebDataPRDX dbRadixData = new RadixWebDataPRDX();

I have the Oracle.DataAccess.dll being copied over, and this still causes an issue.

My stack trace for this error is below, thanks:

Server Error in '/RadixMVC' Application.

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) +1420503
   System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +34

[ArgumentException: The specified store provider cannot be found in the configuration, or is not valid.]
   System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +63
   System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +483
   System.Data.EntityClient.EntityConnection..ctor(String connectionString) +77
   System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) +40
   System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) +17
   RadixMVC.Models.Data.RadixWebDataPRDX..ctor() in C:\Users\862599\Documents\Visual Studio 2010\Projects\RadixMVC\RadixMVC\RadixMVC.Models.Data\RadixDataPRDX.Designer.cs:34
   RadixMVC.Controllers.BaseController..ctor() in C:\Users\862599\Documents\Visual Studio 2010\Projects\RadixMVC\RadixMVC\RadixMVC\Controllers\BaseController.cs:17
   RadixMVC.Controllers.AccountsPayableController..ctor() +29

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +69
   System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +67

[InvalidOperationException: An error occurred when trying to create a controller of type 'RadixMVC.Controllers.AccountsPayableController'. Make sure that the controller has a parameterless public constructor.]
   System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +181
   System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +77
   System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +66
   System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +209
   System.Web.Mvc.<>c__DisplayClass6.<BeginProcessRequest>b__2() +50
   System.Web.Mvc.<>c__DisplayClassb`1.<ProcessInApplicationTrust>b__a() +13
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +23
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Func`1 func) +124
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +98
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8970356
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272


回答1:


The solution to this was what Bob said. The ODAC components had to be installed on the server as well (something I was unaware of). Thanks Bob!



来源:https://stackoverflow.com/questions/11544673/cannot-deploy-mvc-3-project-with-entity-framework-4-3-1-and-oracle-odac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!