Adding migrations: System.MissingMethodException: Method not found ILibraryManager - asp.net

Full error:
System.MissingMethodException: Method not found:
'Microsoft.Extensions.PlatformAbstractions.ILibraryManager
Microsoft.Extensions.PlatformAbstractions.PlatformServices.get_LibraryManager()'.
at Microsoft.Data.Entity.Commands.Program.ValidateProject(String
targetProject) at
Microsoft.Data.Entity.Commands.Program.<>c__DisplayClass2_7.b__15()
at
Microsoft.Dnx.Runtime.Common.CommandLine.CommandLineApplication.Execute(String[]
args) at Microsoft.Data.Entity.Commands.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly
assembly, String[] args, IServiceProvider serviceProvider) at
Microsoft.Dnx.ApplicationHost.Program.<>c__DisplayClass3_0.b__0()
at System.Threading.Tasks.Task`1.InnerInvoke() at
System.Threading.Tasks.Task.Execute()
Command that I try to run:
dnx ef migrations add test1
Version of EF commands:
Entity Framework Commands 7.0.0-rc1-16348
Version of dnx:
Microsoft .NET Execution environment Clr-x86-1.0.0-rc2-16595
My project currently use RC1. It all worked before.

Mostly sure the issue is the fact that you're mixing RC1 packages with RC2 runtime. Downgrade the runtime to RC1 or switch from dnx to dotnet and upgrade the packages to RC2

Related

Setting up .net site in IIS 8.5 (AWS)

My .net project (Any CPU) is referring to Oracle.dataaccess x86 version . In my local GAC the odac version is x86. But in the web server where it was installed previously was having AMB64 version of odac in GAC . The site was working without any problem . Now I need to move the site to AWS .The windows instance in AWS has the below configuration.
OS version : Microsoft windows server 2012 R2 Standard .
IIS 8.5
The server is clean and does not have any software installed .
When I try to create a site , I ended up seeing **could not load file or assembly one of its dependencies **. Through forums I installed various libraries from Oracle but I don't understand what are the exact steps needed . I was just doing trial and error.
Please let me know the software or steps to follow which needs do be installed such that my .net site which is connecting to its Oracle database works .
Edit 1 :
Hi ,
I performed the following steps .
As suggested by you I added Oracle.managedDataaccess dll(x86) . It worked well in my local.
Deployed the same code in the server.
I installed the oracle_12.1.0.1.0
In C:/oracle_12.1.0.1.0/odp.net/managed/x86 I ran the bat file for configuring the managed odac in the server. I was able to see the changes in the machine.config file .
5.Now when I ran the site I got the below error .
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. --->
System.TypeInitializationException: The type initializer for
'Oracle.DataAccess.Client.OracleClientFactory' threw an exception.
---> System.DllNotFoundException: Unable to load DLL 'OraOps12.dll': The specified module could not be found. (Exception from HRESULT:
0x8007007E) at
Oracle.DataAccess.Client.OpsInit.CheckVersionCompatibility(String
version) at Oracle.DataAccess.Client.OracleInit.Initialize() at
Oracle.DataAccess.Client.OracleClientFactory..cctor() --- End of
inner exception stack trace --- --- End of inner exception stack
trace --- at System.RuntimeFieldHandle.GetValue(RtFieldInfo field,
Object instance, RuntimeType fieldType, RuntimeType declaringType,
Boolean& domainInitialized) at
System.Reflection.RtFieldInfo.UnsafeGetValue(Object obj) at
System.Reflection.RtFieldInfo.GetValue(Object obj) at
System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow)
at
System.Data.Entity.Internal.LazyInternalConnection.CreateConnectionFromProviderName(String
providerInvariantName) at
System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings
appConfigConnection) at
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String
name, AppConfig config) at
System.Data.Entity.Internal.LazyInternalConnection.Initialize() at
System.Data.Entity.Internal.LazyInternalConnection.get_Connection()
at Sample.Data.AbstractEFUnitOfWork2.SetClientId(String clientId)
at Sample.Web.Controllers.ApiControllerBase1..ctor(IUow uow,
IConnectionManager cm, IEnumerable`1 allowedAppUserbases, String
connectionName, Boolean allowSaves)
In order to fix this I added OraOps12 dll from c:/oracle_12.1.0.1.0/bin to the wwwroot/site/bin folder. Then I got the below error .
System.ArgumentException: Unable to find the requested .Net Framework
Data Provider. It may not be installed. at
System.Data.Common.DbProviderFactories.GetFactory(String
providerInvariantName) at
System.Data.Entity.Internal.LazyInternalConnection.CreateConnectionFromProviderName(String
providerInvariantName) at
System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings
appConfigConnection) at
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String
name, AppConfig config) at
System.Data.Entity.Internal.LazyInternalConnection.Initialize() at
System.Data.Entity.Internal.LazyInternalConnection.get_Connection()
at Sample.Data.AbstractEFUnitOfWork2.SetClientId(String clientId)
at Sample.Web.Controllers.ApiControllerBase1..ctor(IUow uow,
IConnectionManager cm, IEnumerable`1 allowedAppUserbases, String
connectionName, Boolean allowSaves)
Checking to resolve this .
Appreciate your suggestions.

Unable to start ASP Application using `dnx run` on Ubuntu

I am on Ubuntu 14.04
I have installed ASP using these instructions http://docs.asp.net/en/latest/getting-started/installing-on-linux.html#installing-on-ubuntu-14-04
Running dnvm list gives me the following:
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
* 1.0.0-rc1-update1 coreclr x64 linux default
1.0.0-rc1-update1 mono linux/osx
I then tried to create an ASP application using this tutorial:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-app-using-vscode/
However when I run dnx run I get the following error:
System.InvalidOperationException: IHostingBuilder.UseServer() is required for Start()
at Microsoft.AspNet.Hosting.Internal.HostingEngine.EnsureServer()
at Microsoft.AspNet.Hosting.Internal.HostingEngine.BuildApplication()
at Microsoft.AspNet.Hosting.Internal.HostingEngine.Start()
at Microsoft.AspNet.Hosting.WebApplication.Run(Type startupType, String[] args)
at ASPTutorial.Startup.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
at Microsoft.Dnx.ApplicationHost.Program.<>c__DisplayClass3_0.<ExecuteMain>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
A similar issue arises when I change from coreclr to mono.
UPDATE
dnx web works fine however!
The command to run with dnx is defined in the project.json in your project.
As mentioned in the comments, "run" is usually used for console applications and "web" is used for web applications. But you can write any command name you want in your project.jseon, even something like:
"commands": {
"runmyawesomeapp": "[...]"
}
And you can run it with
> dnx runmyawesomeapp
hope this helps :)

What are the valid DNX --watch flag values?

I'm working on my first ASP.NET 5 application. When trying to start the application from the command line by running:
dnx web --watch
I get the following output:
System.FormatException: Value for switch '--watch' is missing.
at Microsoft.Extensions.Configuration.CommandLine.CommandLineConfigurationProvider.Load()
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Add(IConfigurationProvider provider)
at Microsoft.AspNet.Hosting.WebApplication.Run(Type startupType, String[] args)
at Microsoft.AspNet.Server.Kestrel.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
at Microsoft.Dnx.ApplicationHost.Program.<>c__DisplayClass3_0.<ExecuteMain>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
What are the valid values for the --watch flag? I tried giving it a dummy value of 0 then changed some of my controller code, but the change was not reflected.
Update
To install dnx-watch run the following:
dnu commands install Microsoft.Dnx.Watcher
Then run your application by doing something like:
dnx-watch web
Arguments passed after the command name ("web" in your case) are arguments passed to that command. If you want arguments passed to DNX, pass them before: dnx --watch web
But, --watch will go away. Use dnx-watch instead: https://github.com/aspnet/Announcements/issues/74

ASP.NET VNEXT DNU Restore error

Every time I try to perform a package restore in visual studio, I get the error below. I also get the same error when using the samples from github with the command prompt i.e (
C:\Users\xxxxxx\Documents\GitHub\aspnet\samples\1.0.0-beta4\HelloMvc dnu restore)
I set my execution environment to use the following dnx -dnvm use 1.0.0-beta4 -r clr -arch x86 -p
I have tried deleting the packages from .dnx/packages and have tried replacing the runtimes, but nothing seems to work.
This may be a result of installing visual studio 2015 RC over the CTP 6; however, I have tried uninstalling and re-installing visual studio multiple times.
Any help would be appreciated.
Writing lock file C:\Users\xxxxxx\Documents\Visual Studio 2015\Projects\test3\src\test3\project.lock.json
----------
System.MissingMethodException: **Method not found: 'Newtonsoft.Json.Linq.JValue Newtonsoft.Json.Linq.JValue.CreateNull()'.**
at Microsoft.Framework.Runtime.DependencyManagement.LockFileFormat.WriteString(String item)
at Microsoft.Framework.Runtime.DependencyManagement.LockFileFormat.WriteArray[TItem](IEnumerable`1 items, Func`2 writeItem)
at Microsoft.Framework.Runtime.DependencyManagement.LockFileFormat.WriteProjectFileDependencyGroup(ProjectFileDependencyGroup frameworkInfo)
at Microsoft.Framework.Runtime.DependencyManagement.LockFileFormat.WriteObject[TItem](IEnumerable`1 items, Func`2 writeItem)
at Microsoft.Framework.Runtime.DependencyManagement.LockFileFormat.WriteLockFile(LockFile lockFile)
at Microsoft.Framework.Runtime.DependencyManagement.LockFileFormat.Write(Stream stream, LockFile lockFile)
at Microsoft.Framework.Runtime.DependencyManagement.LockFileFormat.Write(String filePath, LockFile lockFile)
at Microsoft.Framework.PackageManager.RestoreCommand.WriteLockFile(String projectLockFilePath, Project project, List`1 graphItems, PackageRepository repository, IEnumerable`1 frameworks)
at Microsoft.Framework.PackageManager.RestoreCommand.<RestoreForProject>d__74.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Framework.PackageManager.RestoreCommand.<>c__DisplayClass73_0.<<ExecuteCommand>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Framework.PackageManager.RestoreCommand.<ExecuteCommand>d__73.MoveNext()
----------
Restore failed
Method not found: 'Newtonsoft.Json.Linq.JValue Newtonsoft.Json.Linq.JValue.CreateNull()'.
Found the issue: Newtonsoft.json.dll verion 6.0.3 does not contain the CreateNull method. Added version 6.0.8 to the GAC and everything worked.

ASP.NET Web API error after upgrading to Visual Studio 2012 RC: Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation

After upgrading to Visual Studio 2012 I can no longer access any of my ApiControllers, the following error is thrown:
Server Error in '/' Application.
Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation(System.String, System.Collections.Generic.IEnumerable`1<System.String>)'.
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.MissingMethodException: Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation(System.String, System.Collections.Generic.IEnumerable`1<System.String>)'.
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:
[MissingMethodException: Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation(System.String, System.Collections.Generic.IEnumerable`1<System.String>)'.]
System.Web.Http.WebHost.HttpControllerHandler.AddHeaderToHttpRequestMessage(HttpRequestMessage httpRequestMessage, String headerName, String[] headerValues) +0
System.Web.Http.WebHost.HttpControllerHandler.ConvertRequest(HttpContextBase httpContextBase) +248
System.Web.Http.WebHost.HttpControllerHandler.BeginProcessRequest(HttpContextBase httpContextBase, AsyncCallback callback, Object state) +79
System.Web.Http.WebHost.HttpControllerHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +268
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17626
Anyone knows how to fix this?
You have a reference to an old version of System.Net.Http in your project. To fix this, go under "References" in your project, delete System.Net.Http, and add the version that comes with .NET 4.5 instead. That should do it.
Henrik
Solution to this and other RC-related issues right here.
step 1
Remove the below references from your project:
System.Net.Http, System.Web.Http, System.Web.Http.WebHost , System.Web.Http.Common & System.Net.Http.Formatting
step 2
Add the above refefrences (except the System.Web.Http.Common & System.Net.Http.Formatting) from Below location
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Packages\Microsoft.AspNet.WebApi.Core.4.0.20505.0\lib\net40
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Packages\Microsoft.AspNet.WebApi.WebHost.4.0.20505.0\lib\net40
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Packages\Microsoft.Net.Http.2.0.20505.0\lib\net40
and add one more new dll Newtonsoft.Json.dll from
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Packages\Newtonsoft.Json.4.5.1\lib\net40
This fixed it for me.
http://forums.asp.net/t/1809919.aspx/1
Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation(System.String, System.Collections.Generic.IEnumerable`1)'.
I resolved it with the following steps. Not sure if all of them are required, but it worked.
In NuGet Package Manager, uninstalled the Web.API Beta package.
Added references to System.Net.Http, System.Web.Http, & System.Web.Http.WebHost (these were removed by the previous step).
Installed Json.Net via NuGet.
As an addition, if your project is targeting the 4.0 version of the framework, you must include the new Microsoft ASP.Net Web API set of packages from NUGET, to get a green light for your build. Json.Net is a dependency for these new packages, so you need not install it separate.

Resources