Error loading controller - c#

I'm getting the following error and I'm not sure why as I am running code straight off of a template. Does anyone see something in the stack trace that I don't? It is posted below.
Server Error in '/Cfia.Web.MvcTemplate.Example' Application.
The remote server returned an error: (404) Not Found.
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.Net.WebException: The remote server returned
an error: (404) Not Found.
Source of Error:
Line 27: /// Initializes a new instance of the <see cref="ApplicationBaseController" /> class.
Line 28: /// </summary>
Line 29: public ApplicationBaseController()
Line 30: {
Line 31: ApplicationTitle = Labels.GetLabel("Application.MvcTemplate.Examples");
Stack Trace:
[WebException: The remote server returned an error: (404) Not Found.]
System.Net.HttpWebRequest.GetResponse() +8521152
System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials
credentials, IWebProxy proxy, RequestCachePolicy cachePolicy) +160
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type
ofObjectToReturn) +328
System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver) +75
System.Threading.CompressedStack.runTryCode(Object userData) +260
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode
code, CleanupCode backoutCode, Object userData) +0
System.Threading.CompressedStack.Run(CompressedStack compressedStack,
ContextCallback callback, Object state) +118
System.Xml.XmlTextReaderImpl.OpenUrl() +7534355
System.Xml.XmlTextReaderImpl.Read() +187
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean
preserveWhitespace) +176 System.Xml.XmlDocument.Load(XmlReader
reader) +144 System.Xml.XmlDocument.Load(String filename) +205
Cfia.Globalization.Provider.XmlFileLabelProvider.RetrieveAllLabels(CultureInfo
culture) +424
Cfia.Globalization.Provider.LabelService.RetrieveAllRawLabels(CultureInfo
culture) +490
Cfia.Globalization.Provider.LabelService.RetrieveAllLabels(CultureInfo
culture) +50
Cfia.Globalization.Provider.LabelService.Labels(CultureInfo culture)
+344 Cfia.Globalization.Labels.GetLabels(CultureInfo culture) +157 Cfia.Web.Mvc.Menu.FooterLink..ctor() +221
Cfia.Web.Mvc.ControllerBase.BaseController..ctor() +165
Cfia.Web.MvcTemplate.Example2.Controllers.ApplicationBaseController..ctor()
in c:\Users\cir-anglinovd\Documents\Visual Studio
2012\Projects\ContosoUniversity\Cfia.Web.MvcTemplate.Example2\Controllers\ApplicationBaseController.cs:29
Cfia.Web.MvcTemplate.Example2.Controllers.HomeController..ctor() in
c:\Users\cir-anglinovd\Documents\Visual Studio
2012\Projects\ContosoUniversity\Cfia.Web.MvcTemplate.Example2\Controllers\HomeController.cs:30
[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, StackCrawlMark& stackMark) +159
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly,
Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
+256 System.Activator.CreateInstance(Type type, Boolean nonPublic) +127 System.Activator.CreateInstance(Type type) +11 System.Web.Mvc.DefaultControllerActivator.Create(RequestContext
requestContext, Type controllerType) +92
[InvalidOperationException: An error occurred when trying to create a
controller of type
'Cfia.Web.MvcTemplate.Example2.Controllers.HomeController'. Make sure
that the controller has a parameterless public constructor.]
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext
requestContext, Type controllerType) +562491
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext
requestContext, String controllerName) +89
Castle.Proxies.Invocations.IControllerFactory_CreateController.InvokeMethodOnTarget()
+155 Castle.DynamicProxy.AbstractInvocation.Proceed() +116 Glimpse.Core.Extensibility.AlternateMethod.NewImplementation(IAlternateMethodContext
context) +71 Castle.DynamicProxy.AbstractInvocation.Proceed() +604
Castle.Proxies.IControllerFactoryProxy.CreateController(RequestContext
requestContext, String controllerName) +193
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase
httpContext, IController& controller, IControllerFactory& factory)
+305 System.Web.Mvc.<>c__DisplayClass6.b__2() +78 System.Web.Mvc.<>c__DisplayClassb1.<ProcessInApplicationTrust>b__a()
+19 System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Func1 func) +128
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+12551795 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

I fixed it, just had to make some changes in the web.config file.

Related

Oracle Managed Connection throws The type initializer for 'OracleInternal.Common.ProviderConfig exception

oracle.manageddataaccess.client throws exception when try to create the connection from OWIN stand alone web api application.
return new OracleConnection(
new OracleConnectionStringBuilder()
{
DataSource = _server,
Pooling = _poolEnabled,
MinPoolSize = _minPoolSize,
MaxPoolSize = _maxPoolSize,
UserID = _username,
Password = _password,
ConnectionTimeout = _timeout
}.ToString()
);
The code snippets work outside OWIN app. But when called inside owin context it throws exception The type initializer or 'OracleInternal.Common.ProviderConfig' threw an exception, and 'Microsoft.Owin.OwinContext' in assembly is not marked as serializable.
The detailed exception is a follows,
System.TypeInitializationException was unhandled by user code
HResult=-2146233036
Message=The type initializer for 'OracleInternal.Common.ProviderConfig' threw an exception.
Source=Oracle.ManagedDataAccess
TypeName=OracleInternal.Common.ProviderConfig
StackTrace:
at Oracle.ManagedDataAccess.Client.OracleConnectionStringBuilder..ctor()
at XYZ.Habitat.Data.DSXReader.OracleDSXConfig.ConjureConnection() in c:\__work\MIS2\XYZ.Habitat\Data\DSXReader.cs:line 168
at XYZ.Habitat.Data.DSXReader.get_ConnectionString(String index) in c:\__work\MIS2\XYZ.Habitat\Data\DSXReader.cs:line 235
at XYZ.Habitat.Kernel.CreateDbConnection(String key) in c:\__work\MIS2\XYZ.Habitat\Kernel.cs:line 202
at XYZ.REF.Controllers.RefController.List(String id) in c:\__work\MIS2\XYZ.REF\Controllers\RefController.cs:line 66
at lambda_method(Closure , Object , Object[] )
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_1.<GetExecutor>b__3(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
InnerException: System.Configuration.ConfigurationErrorsException
HResult=-2146232062
Message=An error occurred creating the configuration section handler for oracle.manageddataaccess.client: Type 'Microsoft.Owin.OwinContext' in assembly 'Microsoft.Owin, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not marked as serializable. (c:\__work\mis2\__build\Debug\XYZ.MIS2.TEST.dll.config line 46)
Source=System.Configuration
BareMessage=An error occurred creating the configuration section handler for oracle.manageddataaccess.client: Type 'Microsoft.Owin.OwinContext' in assembly 'Microsoft.Owin, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not marked as serializable.
Filename=c:\__work\mis2\__build\Debug\XYZ.MIS2.TEST.dll.config
Line=46
StackTrace:
at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at OracleInternal.Common.CustomConfigFileReader.ParseAndCacheConfigParams()
at OracleInternal.Common.CustomConfigFileReader.ParseConfigFile()
at OracleInternal.Common.ConfigBaseClass.GetInstance(Boolean bIsManaged)
at OracleInternal.Common.ProviderConfig..cctor()
InnerException: System.Runtime.Serialization.SerializationException
HResult=-2146233076
Message=Type 'Microsoft.Owin.OwinContext' in assembly 'Microsoft.Owin, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not marked as serializable.
Source=mscorlib
StackTrace:
at System.AppDomain.get_Evidence()
at System.AppDomain.get_EvidenceNoDemand()
at System.AppDomain.get_Evidence()
at System.Configuration.ClientConfigPaths.GetEvidenceInfo(AppDomain appDomain, String exePath, String& typeName)
at System.Configuration.ClientConfigPaths.GetTypeAndHashSuffix(AppDomain appDomain, String exePath)
at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigurationHost.RequireCompleteInit(IInternalConfigRecord record)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Xml.XmlConfiguration.XmlReaderSection.get_ProhibitDefaultUrlResolver()
at System.Xml.Schema.Parser..ctor(SchemaType schemaType, XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler eventHandler)
at System.Xml.Schema.XmlSchemaSet.ParseSchema(String targetNamespace, XmlReader reader)
at System.Xml.Schema.XmlSchemaSet.Add(String targetNamespace, XmlReader schemaDocument)
at OracleInternal.Common.CustomConfigFileReader.ValidateBaseDocument(XmlDocument doc)
at OracleInternal.Common.ODPMSectionHandler.DeserializeElement(XmlReader reader, Boolean serializeCollectionKey)
at System.Configuration.ConfigurationSection.DeserializeSection(XmlReader reader)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionImpl(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
at System.Configuration.RuntimeConfigurationRecord.CreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
at System.Configuration.BaseConfigurationRecord.CallCreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader, String filename, Int32 line)
InnerException:
I got this same error "The type initializer for 'OracleInternal.Common.ProviderConfig' threw an exception".
When I ran my app, in my Console error messages, "There is a duplicate 'oracle.manageddataaccess.client' section defined."
Turns out the definition for Oracle.ManagedDataAccess was in my WebAPI web.config and also the machine config.
Had to update THIS specific machine.config: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config - do a search on "managed" and comment out in 3 places.

An exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll but was not handled in user code

An exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll but was not handled in user code
Additional information: Exception has been thrown by the target of an invocation.
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
this is my code where exception is showing at runtime.
Iam using .net framework 4.5 and sqlserver2008r2.
so can anyone can help me to get out of this problem.
Stack Trace:
[TypeLoadException: Could not load type 'System.Data.Entity.Infrastructure.TableExistenceChecker' from assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
System.Data.Entity.SqlServerCompact.Legacy.SqlCeProviderServices..ctor() +0
System.Data.Entity.SqlServerCompact.Legacy.SqlCeProviderServices..cctor() +44
[TypeInitializationException: The type initializer for 'System.Data.Entity.SqlServerCompact.Legacy.SqlCeProviderServices' threw an exception.]
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeFieldHandle.GetValue(RtFieldInfo field, Object instance, RuntimeType fieldType, RuntimeType declaringType, Boolean& domainInitialized) +0
System.Reflection.RtFieldInfo.UnsafeGetValue(Object obj) +124
System.Reflection.RtFieldInfo.InternalGetValue(Object obj, StackCrawlMark& stackMark) +132
System.Reflection.RtFieldInfo.GetValue(Object obj) +21
System.Data.Entity.Utilities.MemberInfoExtensions.GetValue(MemberInfo memberInfo) +132
System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(Type providerType) +194
System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) +142
System.Data.Entity.Internal.AppConfig.<.ctor>b__2(ProviderElement e) +109
System.Linq.WhereSelectEnumerableIterator2.MoveNext() +145
System.Collections.Generic.List1..ctor(IEnumerable1 collection) +460
System.Linq.Enumerable.ToList(IEnumerable1 source) +58
System.Data.Entity.Internal.AppConfig.<.ctor>b__1() +135
System.Lazy1.CreateValue() +415
System.Lazy1.LazyInitValue() +152
System.Lazy1.get_Value() +75
System.Data.Entity.Internal.AppConfig.get_DbProviderServices() +40
System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.RegisterDbProviderServices() +59
System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetServiceFactory(Type type, String name) +126
System.Data.Entity.Infrastructure.DependencyResolution.<>c__DisplayClass1.<GetService>b__0(Tuple2 t) +110
System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) +72
System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetService(Type type, Object key) +210
System.Data.Entity.Infrastructure.DependencyResolution.<>c__DisplayClass3.b__0(IDbDependencyResolver r) +60
System.Linq.WhereSelectArrayIterator2.MoveNext() +66
System.Linq.Enumerable.FirstOrDefault(IEnumerable1 source, Func2 predicate) +94
System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.GetService(Type type, Object key) +250
System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver2.GetService(Type type, Object key) +63
System.Data.Entity.Infrastructure.DependencyResolution.DbDependencyResolverExtensions.GetService(IDbDependencyResolver resolver) +141
System.Data.Entity.DbContext.InitializeLazyInternalContext(IInternalConnection internalConnection, DbCompiledModel model) +124
System.Data.Entity.DbContext..ctor(String nameOrConnectionString) +103
Microsoft.AspNet.Identity.EntityFramework.IdentityDbContext6..ctor(String nameOrConnectionString) +37
Microsoft.AspNet.Identity.EntityFramework.IdentityDbContext1..ctor(String nameOrConnectionString, Boolean throwIfV1Schema) +45
Srismiles.Models.ApplicationDbContext..ctor() in f:\Srismiles\Srismiles\Srismiles\Models\IdentityModels.cs:32
Srismiles.Logic.RoleActions.AddUserAndRole() in f:\Srismiles\Srismiles\Srismiles\Logic\RoleActions.cs:17
Srismiles.Global.Application_Start(Object sender, EventArgs e) in f:\Srismiles\Srismiles\Srismiles\Global.asax.cs:29
[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9935033
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9913572
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
You should definitely try to do 2 things:
Update EF packages to the latest version in all projects (Update-Package EntityFramework will work for you in package console)
Use Update-Database command in all projects that have data context on your database
I faced the same problem right now and it was solved via these steps.

System.Runtime.Remoting.RemotingException: Cannot load type

I have uploaded my application to Client .We are getting "System.Runtime.Remoting.RemotingException: Cannot load type" error .I am new to use remoting.Can any one let me know how to resolve this issue.Same set of files are working in my local server .Its throughing System.Runtime.Remoting.RemotingException: Cannot load type error while connecting to remote server .I have tried several ways but in vain
Error Occured while connecting RemoteServer.System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.Remoting.RemotingException: Cannot load type RemoteServer.SPN.ChargebackSPNRemoteServer, RemoteServer.SPN, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null.
Server stack trace:
at System.Runtime.Remoting.Activation.ActivationListener.Activate(IConstructionCallMessage ctorMsg)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.Runtime.Remoting.Activation.IActivator.Activate(IConstructionCallMessage msg)
at System.Runtime.Remoting.Activation.LocalActivator.DoRemoteActivation(IConstructionCallMessage ctorMsg)
at System.Runtime.Remoting.Activation.LocalActivator.Activate(IConstructionCallMessage ctorMsg)
at System.Runtime.Remoting.Activation.AppDomainLevelActivator.Activate(IConstructionCallMessage ctorMsg)
at System.Runtime.Remoting.Messaging.ClientContextTerminatorSink.SyncProcessMessage(IMessage reqMsg)
at System.Runtime.Remoting.Activation.ActivationServices.Activate(RemotingProxy remProxy, IConstructionCallMessage ctorMsg)
at System.Runtime.Remoting.Proxies.RemotingProxy.InternalActivate(IConstructionCallMessage ctorMsg)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(IMessage reqMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at RemoteServer.SPN.ChargebackSPNRemoteServer..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at Com. Service.Items.InProcess.SPNServiceProvider.ConnectDBServerRemote(String p_strURLforRemoteSite)
2014-10-03 11:00:58,251 [5084] ERROR - InnerException RemoteServer.System.Runtime.Remoting.RemotingException: Cannot load type RemoteServer.SPN.ChargebackSPNRemoteServer, . RemoteServer.SPN, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null.
Server stack trace:
at System.Runtime.Remoting.Activation.ActivationListener.Activate(IConstructionCallMessage ctorMsg)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.Runtime.Remoting.Activation.IActivator.Activate(IConstructionCallMessage msg)
at System.Runtime.Remoting.Activation.LocalActivator.DoRemoteActivation(IConstructionCallMessage ctorMsg)
at System.Runtime.Remoting.Activation.LocalActivator.Activate(IConstructionCallMessage ctorMsg)
at System.Runtime.Remoting.Activation.AppDomainLevelActivator.Activate(IConstructionCallMessage ctorMsg)
at System.Runtime.Remoting.Messaging.ClientContextTerminatorSink.SyncProcessMessage(IMessage reqMsg)
at System.Runtime.Remoting.Activation.ActivationServices.Activate(RemotingProxy remProxy, IConstructionCallMessage ctorMsg)
at System.Runtime.Remoting.Proxies.RemotingProxy.InternalActivate(IConstructionCallMessage ctorMsg)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(IMessage reqMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at RemoteServer.SPN.ChargebackSPNRemoteServer..ctor()

New MVC4 Application on AppHarbor, getting error: Unable to find the requested .Net Framework Data Provider. It may not be installed

I have deployed an MVC4 application to AppHarbor using Git and I added the SQL Server add-on to my AppHarbor application project. The project builds just fine and when I navigate to the url of my application and click the Login button I get
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) +77
WebMatrix.Data.DbProviderFactoryWrapper.CreateConnection(String connectionString) +48
WebMatrix.Data.<>c__DisplayClass15.<OpenConnectionStringInternal>b__14() +16
WebMatrix.Data.Database.get_Connection() +19
WebMatrix.Data.Database.EnsureConnectionOpen() +13
WebMatrix.Data.<QueryInternal>d__0.MoveNext() +66
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +183
WebMatrix.Data.Database.QuerySingle(String commandText, Object[] args) +44
WebMatrix.WebData.DatabaseWrapper.QuerySingle(String commandText, Object[] parameters) +14
WebMatrix.WebData.SimpleMembershipProvider.CheckTableExists(IDatabase db, String tableName) +54
WebMatrix.WebData.SimpleMembershipProvider.CreateTablesIfNeeded() +57
WebMatrix.WebData.WebSecurity.InitializeMembershipProvider(SimpleMembershipProvider simpleMembership, DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean createTables) +81
WebMatrix.WebData.WebSecurity.InitializeProviders(DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables) +52
WebMatrix.WebData.WebSecurity.InitializeDatabaseConnection(String connectionStringName, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables) +60
ExploreGame01.Filters.SimpleMembershipInitializer..ctor() in d:\temp\uoppttzv.jeq\input\ExploreGame01\Filters\InitializeSimpleMembershipAttribute.cs:41
[InvalidOperationException: The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588]
ExploreGame01.Filters.SimpleMembershipInitializer..ctor() in d:\temp\uoppttzv.jeq\input\ExploreGame01\Filters\InitializeSimpleMembershipAttribute.cs:45
[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, StackCrawlMark& stackMark) +159
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +251
System.Activator.CreateInstance(Type type, Boolean nonPublic) +87
System.Activator.CreateInstance(Type type) +6
System.Threading.LazyHelpers`1.ActivatorFactorySelector() +68
System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +114
System.Threading.LazyInitializer.EnsureInitialized(T& target, Boolean& initialized, Object& syncLock) +113
ExploreGame01.Filters.InitializeSimpleMembershipAttribute.OnActionExecuting(ActionExecutingContext filterContext) in d:\temp\uoppttzv.jeq\input\ExploreGame01\Filters\InitializeSimpleMembershipAttribute.cs:21
System.Web.Mvc.Async.AsyncControllerActionInvoker.InvokeActionMethodFilterAsynchronously(IActionFilter filter, ActionExecutingContext preContext, Func`1 nextInChain) +77
System.Web.Mvc.Async.<>c__DisplayClass3b.<BeginInvokeActionMethodWithFilters>b__35() +22
System.Web.Mvc.Async.AsyncControllerActionInvoker.InvokeActionMethodFilterAsynchronously(IActionFilter filter, ActionExecutingContext preContext, Func`1 nextInChain) +543
System.Web.Mvc.Async.<>c__DisplayClass3b.<BeginInvokeActionMethodWithFilters>b__35() +22
System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__31(AsyncCallback asyncCallback, Object asyncState) +201
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +120
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +79
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag) +64
System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters, AsyncCallback callback, Object state) +162
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__1e(AsyncCallback asyncCallback, Object asyncState) +512
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +120
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +52
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag) +19
System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +252
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__17(AsyncCallback asyncCallback, Object asyncState) +37
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +120
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +52
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag, Int32 timeout) +37
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag) +19
System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +284
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +120
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +52
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag, Int32 timeout) +37
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag) +19
System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +242
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +15
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__2(AsyncCallback asyncCallback, Object asyncState) +76
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +120
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +52
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag, Int32 timeout) +37
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag) +19
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +176
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() +875
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +234
From what I can tell from other posts is that I am having a problem with my connection string to the database. However, I've copied the supplied connection string from AppHarbor and put it into my web.config.
Until now I've only ever run my app on localhost and everything has always run just fine.
Can anyone please provide some advice?
Turns out, I did not include the new SQL server connection string for both of my applications connection strings. While most of my application uses a custom made connection string, DefaultConnection was being used for the login and Register pages.
Once I added the connection string provided for me to the DefaultConnection everything worked fine.

MMC development in c#

Hi i am developing MMC snap in C#,
in this i want to read XML file so where to put my xml file.
the code is not giving any build error but when i am adding the snapin in MMC its giveing error what to do.
[SnapInSettings("{2078B103-76FF-46E1-95BB-8B2CE3A72E60}",
DisplayName = "Configuration",
Description = "abc Pvt Ltd.")
]
public class Mymmc : SnapIn
{
XDocument xDoc;
public Sararmmc()
{
ScopeNode childscopenode;
xDoc = XDocument.Load("MMCSnapinXML.xml");
IEnumerable<XElement> xelements = xDoc.Root.Descendants();
this.RootNode = new ScopeNode();
this.RootNode.DisplayName = xDoc.Root.Attribute("name").Value;
foreach (XElement elm in xelements)
{
childscopenode = new ScopeNode();
childscopenode.DisplayName = elm.Attribute("name").Value;
this.RootNode.Children.Add(childscopenode);
}
}
}
i am getting
Exception has been thrown by the target of an invocation.
Server stack trace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName, String typeName)
at System.AppDomain.CreateInstance(String assemblyName, String typeName)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName)
at Microsoft.ManagementConsole.Internal.SnapInClient.CreateSnapIn(String assemblyName, String typeName)
at Microsoft.ManagementConsole.Internal.ClassLibraryServices.Microsoft.ManagementConsole.Internal.IClassLibraryServices.CreateSnapIn(String assemblyName, String typeName)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at Microsoft.ManagementConsole.Executive.SnapInInitializationOperation.OnStart()
at Microsoft.ManagementConsole.Executive.Operation.Start()
at Microsoft.ManagementConsole.Executive.RunningOperationsTable.EnqueueOperation(Operation operation)
at Microsoft.ManagementConsole.Executive.StandAloneComponentData..ctor(SnapInRegistrationInfo info, Int32 bookkeepingId)
at Microsoft.ManagementConsole.Advanced.FrameworkSnapInFactory.Microsoft.ManagementConsole.Advanced.ISnapInFactory.CreateSnapIn(Int32 bookkeepingId, String snapInKey, Object& snapIn)
There are many exceptions which could be thrown in your constructor (the stack trace indicates that this is the source of the error). It could be a malformed XML exception is thrown on XDocument.Load, it could also be null reference exception if any of the named nodes/attributes you're accessing don't exist. It could be a file not found exception, or even a SecurityException - it could even be something more obscure such as MMC requiring that your assembly is signed.. without knowing what type of exception you're getting it's very difficult for anyone to help you!
As I said in my comment, when you receive errors at runtime that you can't easily explain - this is when having verbose logging in your application becomes really valuable! NLog and log4net are the two most popular logging frameworks for .NET applications

Categories