Saving user secrets throws an exception in 'Asp .Net 5 beta 7'. Specifically, when I execute this statement:
user-secret set Authentication:Facebook:AppId 1234567890
the following exception occurs:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Framework.ApplicationHost' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.Framework.ApplicationHost'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Microsoft.Dnx.Runtime.Loader.LoadContext.Load(AssemblyName assemblyName)
at Microsoft.Dnx.Host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env, FrameworkName targetFramework)
at Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String[] args, FrameworkName targetFramework)
at Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String[] args, FrameworkName targetFramework)
This worked correctly with beta 6. Does anyone know why this exception occurs and what I need to do to fix it?
There was a breaking change. Uninstall the old one and install the new one.
Old behavior:
dnu commands install SecretManager
New behavior:
dnu commands install Microsoft.Framework.SecretManager
Related
I'm trying to setup an old MVC 3 Application on my development machine and trying to make it work. I'm getting he following error. I'm not sure how to resolve this. I appreciate any help over this.
Execution permission cannot be acquired.
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.Security.Policy.PolicyException: Execution permission cannot be acquired.
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:
[PolicyException: Execution permission cannot be acquired.]
System.Security.CodeAccessSecurityEngine.TryResolveGrantSet(Evidence evidence, PermissionSet& grantSet) +11652088
System.Security.CodeAccessSecurityEngine.ResolveGrantSet(Evidence evidence, Int32& specialFlags, Boolean checkExecutionPermission) +44
[FileLoadException: Could not load file or assembly 'Microsoft.VisualStudio.Web.PageInspector.Runtime, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. PolicyException thrown. (Exception from HRESULT: 0x80131416)]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +102
System.Reflection.Assembly.LoadFrom(String assemblyFile) +34
Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader.GetRuntimeAssemblyFromRegistry(Assembly& runtime) +23
Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader.LoadRuntime() +21
Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader.PreApplicationStart() +46
[InvalidOperationException: The pre-application start initialization method PreApplicationStart on type Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader threw an exception with the following error message: Could not load file or assembly 'Microsoft.VisualStudio.Web.PageInspector.Runtime, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. PolicyException thrown. (Exception from HRESULT: 0x80131416).]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +613
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +141
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +102
System.Web.Compilation.BuildManager.ExecutePreAppStart() +157
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +531
[HttpException (0x80004005): The pre-application start initialization method PreApplicationStart on type Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader threw an exception with the following error message: Could not load file or assembly 'Microsoft.VisualStudio.Web.PageInspector.Runtime, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. PolicyException thrown. (Exception from HRESULT: 0x80131416).]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9946132
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261
MiniProfiler is not working too well for me. Even installation was broken, and had to be fixed with the aid of an answer to another question here.
I have two problems below.
I followed all the installation steps on the website.. as follows copying from my code.
These things have been altered (global.asax):
... Application_Start ...
MiniProfilerEF6.Initialize();
....
MiniProfiler.Settings.Results_List_Authorize = IsUserAllowedToSeeMiniProfilerUI;
MiniProfiler.Settings.Results_Authorize = IsUserAllowedToSeeMiniProfilerUI;
...
And this (layout file):
...
#MiniProfiler.RenderIncludes()
</body>
...
Problem 1:
The MiniProfilerEF6.Initialize() call throws an exception.
System.Data.SqlClient.SqlException was unhandled by user code
Message=Invalid object name 'dbo.EdmMetadata'.
StackTrace:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteDbDataReader(CommandBehavior behavior) in c:\TeamCity\buildAgent\work\a743336045964cbc\StackExchange.Profiling\Data\ProfiledDbCommand.cs:line 246
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c(DbCommand t, DbCommandInterceptionContext`1 c)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
Problem 2:
If I disable the non-working database stuff, viewing the pages for the results (in Chrome) shows nothing. Viewing the results index page gives the following in the Chrome console (404 errors in the networking pane):
results-index:3 GET http://localhost/vll/mini-profiler-resources/includes.js?v=ySF6M98CBehTtL86BbiEmys9yxR1HKazhe2sznfdUWQ=
results-index:4 GET http://localhost/vll/mini-profiler-resources/includes.css?v=ySF6M98CBehTtL86BbiEmys9yxR1HKazhe2sznfdUWQ=
results-index:6 Uncaught ReferenceError: MiniProfiler is not defined(anonymous function) # results-index:6
Why doesn't miniprofiler work as described?
I have a MVC 4 Project (Company.Project.WebUI), a project for all my model classes (Company.Project.Data) and a project for the DAL (Company.Project.Services).
How can I manage this with Code First Migrations?
I'm getting the following error when I write the command Add-Migration Init:
`
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.FindConfiguration()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()
at System.Data.Entity.Migrations.Design.ToolingFacade.GetPendingMigrationsRunner.RunCore()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
`
When I write the command Add-Migration -StartUpProjectName "Company.Project.Services" Init I'll get also an error
`
System.IO.FileNotFoundException: Could not load file or assembly 'Company.Project.WebUI' or one of its dependencies. The system cannot find the file specified.
File name: 'Company.Project.WebUI'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.FindConfiguration()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()
at System.Data.Entity.Migrations.Design.ToolingFacade.GetPendingMigrationsRunner.RunCore()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
`
Could somebody tell me what's the best way to use EF Code First Migration with different dlls?
I don't know why, but EF wants your DAL project to be set as the start up project in Visual Studio. I just had the same error and this solved the problem.
On Solution Explorer: Right Click to your DAL project -> select "Set as StartUp Project".
I was trying to set the DotNetNuke Content localization, but when I click on enable localized content on language page the progress bar that show up stuck.
I was checking the event log and i noticed that it raises a general exception:
DefaultDataProvider: DotNetNuke.Data.SqlDataProvider,
DotNetNuke.SqlDataProvider ExceptionGUID:
a139c600-71a0-4ee3-a66f-5968bd2bdfde InnerException: Transaction
(Process ID 56) was deadlocked on lock resources with another process
and has been chosen as the deadlock victim. Rerun the transaction.
FileName: FileLineNumber: 0 FileColumnNumber: 0 Method:
System.Data.SqlClient.SqlConnection.OnError StackTrace: Message:
System.Data.SqlClient.SqlException: Transaction (Process ID 56) was
deadlocked on lock resources with another process and has been chosen
as the deadlock victim. Rerun the transaction. at
System.Data.SqlClient.SqlConnection.OnError(SqlException exception,
Boolean breakConnection) at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior
runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj) at
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,
RunBehavior runBehavior, String resetOptionsString) at
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean
async) at
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method, DbAsyncResult result) at
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult
result, String methodName, Boolean sendToPipe) at
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(SqlConnection
connection, CommandType commandType, String commandText,
SqlParameter[] commandParameters) at
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String
connectionString, CommandType commandType, String commandText,
SqlParameter[] commandParameters) at
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String
connectionString, String spName, Object[] parameterValues) at
DotNetNuke.Data.SqlDataProvider.AddSearchItemWordPosition(Int32
SearchItemWordID, String ContentPositions) at
DotNetNuke.Services.Search.SearchDataStore.AddIndexWords(Int32
indexId, SearchItemInfo searchItem, String language) at
DotNetNuke.Services.Search.SearchDataStore.StoreSearchItems(SearchItemInfoCollection
SearchItems)
It should localize pages in three languages, pt-BR(Main), en-US and es-ES. But it only works on en-US. It succefully localize all the pages in en-US but in es-ES it just does the first page.
Now anytime i try to do some page related activities, as adding a page in the 3 languages, the pages gets bugged and keep rising exceptions when i'm trying to edit it. And the page doesn't show up in es-ES language, only in pt and en. This elimineted all workaround that i could think and couldnt find any solution on web.
There is a bug in the search engine scheduler for DotNetNuke. Disable the scheduler, or increasing the time between scheduler activity to avoid concurrent updates. See this thread. http://forums.asp.net/t/905236.aspx/1
I'm trying to have my ASP.NET MVC2 controllers built using StructureMap but ASP.NET doesn't seem to remember that I've called ControllerBuilder.Current.SetControllerFactory in my Global.asax file.
Specifically I get the error that my controller has no parameterless constructor. The stack trace reveals that my custom ControllerFactory was never actually executed.
Here is my call to the method that should tell ASP.NET which ControllerFactory to use:
Sub Application_Start()
RegisterRoutes(RouteTable.Routes)
ControllerBuilder.Current.SetControllerFactory(GetType(StructureMapControllerFactory))
BootStrapper.RegisterDependencies()
End Sub
And here's the exception that I receive.
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +86
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +230
System.Activator.CreateInstance(Type type, Boolean nonPublic) +67
System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +80
Why is ASP.NET forgetting which ControllerFactory to use?
How is your StructureMapControllerFactory defined? Does it have a default constructor?
If not, try using that second overload of the SetControllerFactory method:
// First create the controllerFactory instance...
ControllerBuilder.Current.SetControllerFactory(controllerFactory);
You have to set your controllerFactory before you RegisterRoutes...