Cannot Deploy MVC 3 Project with Entity Framework 4.3.1 and Oracle ODAC - asp.net-mvc-3

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

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!

Related

Could not load file or assembly 'Microsoft.EnterpriseManagement.OperationsManager.Apm.DataCollecting.Producers.Mvc.4.0

We were running Windows Server 2008 R2 and upgraded to 2016 and since then our applications have stopped running. ASP.NET Web Forms is still working and only MVC seems to have stopped running.
They were all thrwoing HTTP 503 error and after repaiting IIS URL Rewrite Module 2, they have started throwing the following error:
Server Error in '/Mail' Application.
Could not load file or assembly 'Microsoft.EnterpriseManagement.OperationsManager.Apm.DataCollecting.Producers.Mvc.4.0, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
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.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EnterpriseManagement.OperationsManager.Apm.DataCollecting.Producers.Mvc.4.0, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
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.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.EnterpriseManagement.OperationsManager.Apm.DataCollecting.Producers.Mvc.4.0, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace:
[FileNotFoundException: Could not load file or assembly 'Microsoft.EnterpriseManagement.OperationsManager.Apm.DataCollecting.Producers.Mvc.4.0, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +0
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +194
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +80
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +70
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +18
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +444
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +157
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2106.0
I managed to solve by doing two things:
Repairing the IIS URL Rewrite Module
Uninstalling Microsoft Monitoring Agent which contains the assembly that MVC application is complaining about.

Portable data annotations does not work in UWP project

ITNOA
Hi all,
I use portable data annotations in Xamarin forms, When I deploy UWP project and run it, I catch MissingManifestResourceException (exceptions details added below) while I added portable data annotations in PCL project and UWP project both.
I try Net46-Portable.DataAnnotations
and Portable-Strong.DataAnnotations but does not work again.
Where is my wrong?
My UWP project Target version Windows 10 Anniversary Edition (10.0; Build 14393)
My UWP project Min version Windows 10 (10.0; Build 10586)
My mobile I test it is Windows phone 10 Anniversary Edition.
Xamarin forms version is 2.3.4.171-pre1
Thanks
System.Resources.MissingManifestResourceException occurred
HResult=-2146233038
Message=Unable to load resources for resource file "System.ComponentModel.DataAnnotations.Resources.DataAnnotationsResources" in package "ResaDoctorApp".
Source=mscorlib
StackTrace:
at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
at System.ComponentModel.DataAnnotations.Resources.DataAnnotationsResources.get_EmailAddressAttribute_Invalid()
at System.ComponentModel.DataAnnotations.EmailAddressAttribute..ctor()
at System.RuntimeTypeHandle.CreateCaInstance(RuntimeType type, IRuntimeMethodInfo ctor)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType)
at System.Reflection.RuntimePropertyInfo.GetCustomAttributes(Type attributeType, Boolean inherit)
at System.Attribute.InternalGetCustomAttributes(PropertyInfo element, Type type, Boolean inherit)
at System.Attribute.GetCustomAttributes(MemberInfo element, Boolean inherit)
at System.Reflection.CustomAttributeExtensions.GetCustomAttributes(MemberInfo element, Boolean inherit)
at AutoMapper.Configuration.MappingExpression`2.Configure(IProfileConfiguration profile, TypeMap typeMap)
at AutoMapper.Profile.BuildTypeMap(TypeMapRegistry typeMapRegistry, ITypeMapConfiguration config)
at AutoMapper.Profile.AutoMapper.IProfileConfiguration.Register(TypeMapRegistry typeMapRegistry)
at AutoMapper.MapperConfiguration.Seal(IConfiguration configuration)
at AutoMapper.MapperConfiguration..ctor(MapperConfigurationExpression configurationExpression, IEnumerable`1 mappers)
at AutoMapper.Mapper.Initialize(Action`1 config)
at DoctorApp.Models.Doctor.FillFromFather(DoctorPreview preview)
InnerException:

What may cause OWIN to intermittently fail to load?

Recently some unusual errors have started appearing on our development server. We are using Jenkins to build and deploy an ASP.NET Web API that uses OWIN and up until now everything has been working correctly. However, recently we have started to intermittently see errors like the following, lightly redacted error from the Windows Event Log:
Exception information:
Exception type: EntryPointNotFoundException
Exception message: The following errors occurred while attempting to load the app.
- No assembly found containing an OwinStartupAttribute.
- The given type or method 'Api.Startup' was not found. Try specifying the Assembly.
To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config.
To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.config.
at Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup()
at Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint()
at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)
at Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context)
at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)
at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)
Recycling the IIS application pool generally resolves the problem but the fact it is happening is concerning. Any ideas as to what might be causing this to happen?

MVCSiteMapProvider gives null reference when moved to production

I am writing an MVC 4.5 application using MVCSiteMapProvider 4.4.9.0. When developing in Visual Studio running the Visual Studio Development Server, everything works as expected. However, after publishing the project to the production server, I am running into a NullReferenceException. Here is the call stack. (Sorry, not enough reputation points to post screen shot)
Server Error in '/' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
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:
[NullReferenceException: Object reference not set to an instance of an object.]
MvcSiteMapProvider.Reflection.MvcSiteMapNodeAttributeDefinitionProvider.GetAttributeDefinitionsForControllers(Type type) +71
MvcSiteMapProvider.Reflection.MvcSiteMapNodeAttributeDefinitionProvider.GetMvcSiteMapNodeAttributeDefinitions(IEnumerable`1 assemblies) +168
MvcSiteMapProvider.DI.SiteMapNodeFactoryContainer.GetMvcSiteMapNodeAttributeDynamicNodeProviderNames() +105
MvcSiteMapProvider.DI.SiteMapNodeFactoryContainer.ResolveDynamicNodeProviders() +148
MvcSiteMapProvider.DI.SiteMapNodeFactoryContainer..ctor(ConfigurationSettings settings, IMvcContextFactory mvcContextFactory, IUrlPath urlPath) +306
MvcSiteMapProvider.DI.SiteMapLoaderContainer..ctor(ConfigurationSettings settings) +409
MvcSiteMapProvider.DI.Composer.Compose() +430
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +229
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +193
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +35
WebActivatorEx.BaseActivationMethodAttribute.InvokeMethod() +341
WebActivatorEx.ActivationManager.RunActivationMethods(Boolean designerMode) +854
WebActivatorEx.ActivationManager.RunPostStartMethods() +40
WebActivatorEx.StartMethodCallingModule.Init(HttpApplication context) +159
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +530
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475
[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12881540
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12722601
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
I have done a search on this error and the ones I have found showed a completely different call stack trace.
Here is the MVC.SiteMap
<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0"
xsi:schemaLocation="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0 MvcSiteMapSchema.xsd">
<mvcSiteMapNode title="Projects" controller="Project" action="Index">
<mvcSiteMapNode title="Supplier/Trade" controller="SupplierTrade" action="Index" preservedRouteParameters="pid">
<mvcSiteMapNode title="Approval Actions" controller="SupplierTrade" action="ApprovalActions" preservedRouteParameters="pid, stmid">
<mvcSiteMapNode title="Edit PMs" controller="User" action="Index" preservedRouteParameters="pid, stmid"/>
<mvcSiteMapNode title="Contractor Standard Invoice Percent" controller="ContractorStandardInvoicePercent" action="Index" preservedRouteParameters="pid, stmid"/>
<mvcSiteMapNode title="Approval Status Of CostCode" controller="ApprovalStatusOfCostCode" action="Index" preservedRouteParameters="pid, stmid"/>
</mvcSiteMapNode>
</mvcSiteMapNode>
</mvcSiteMapNode>
</mvcSiteMap>
I keep thinking that there is some configuration setting I am missing or a file that is on my dev machine but not on the production machine as version 3.3.6 works flawlessly. Any ideas?
The error indicates there is something wrong when MvcSiteMapProvider scans your project for [MvcSiteMapNodeAttribute] nodes. Some things you could try:
If you are not using [MvcSiteMapNodeAttribute] in your application, you can disable this scanning by setting "MvcSiteMapProvider_ScanAssembliesForSiteMapNodes" to "false" in web.config.
If you are using [MvcSiteMapNodeAttribute], make sure you add all of the assemblies where you have them defined in "MvcSiteMapProvider_IncludeAssembliesForScan", separated by commas. Make sure each name matches what is defined in the "Assembly name" field in project properties on the Application tab. This (or the "MvcSiteMapProvider_ExcludeAssembliesForScan") field is required when "MvcSiteMapProvider_ScanAssembliesForSiteMapNodes" is "true".
If you are using "MvcSiteMapProvider_ExcludeAssembliesForScan", try switching to using "MvcSiteMapProvider_IncludeAssembliesForScan" to ensure MvcSiteMapProvider isn't picking up some assemblies that it shouldn't.
Reference: Configuring MvcSiteMapProvider

NUnit 2.5.9 Problem

Good morning, afternoon, or night,
I am trying to use NUnit 2.5.9 to run some unit tests contained in an assembly built with Visual Studio 2010 which targets .NET 2.0. However, I keep getting a System.BadImageFormatException exception everytime... I tried the workarounds described here, but to no avail. I have also downloaded the source code and compiled it under Visual Studio 2010 targeting .NET 2.0, but the exception keeps popping up... What is going wrong here?
System.BadImageFormatException...
Server stack trace:
em System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
em System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
em System.Reflection.Assembly.Load(AssemblyName assemblyRef)
em NUnit.Core.Builders.TestAssemblyBuilder.Load(String path)
em NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)
em NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)
em NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
em NUnit.Core.SimpleTestRunner.Load(TestPackage package)
em NUnit.Core.ProxyTestRunner.Load(TestPackage package)
em NUnit.Core.ProxyTestRunner.Load(TestPackage package)
em NUnit.Core.RemoteTestRunner.Load(TestPackage package)
em System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
em System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
em System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
em System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
em NUnit.Core.TestRunner.Load(TestPackage package)
em NUnit.Util.TestDomain.Load(TestPackage package)
em NUnit.Util.TestLoader.LoadTest(String testName)
Thank you very much.
I've seen similar errors trying to test x86 assemblies on a 64-bit system.
You may need to run nunit-x86.exe instead of nunit.exe.

Resources