Dears all
I am working on a project using Identity authentication. Everything was working alright and I added automapper library. After that when i ran the project i started getting;
MissingMethodException: Method not found: 'Boolean
Microsoft.AspNetCore.Cryptography.UnsafeNativeMethods.CryptProtectData(Microsoft.AspNetCore.Cryptography.DATA_BLOB*,
IntPtr, Microsoft.AspNetCore.Cryptography.DATA_BLOB*, IntPtr, IntPtr,
UInt32, Microsoft.AspNetCore.Cryptography.DATA_BLOB ByRef)'.
I am unable to trace the source of this error. Any help will be appreciated.
I am building the application on .net core 6.
Related
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.
None of the SQLite .NET packages work in FSI, even when referencing a module in a fs project. I've tried System.Data.SQLite, SQLitePCL.raw, and Microsoft.Data.Sqlite.
From System.Data.SQLite docs:
If the executable that starts the process consists entirely of managed code, it will run with the native processor architecture of the machine, which will be x64 on an x64 machine. Later on, this will cause assemblies containing any native code compiled for x86 (e.g. the "System.Data.SQLite.dll" mixed-mode assembly, the "SQLite.Interop.dll" native interop assembly, or the "sqlite3.dll" native library) to fail to load, typically resulting in a BadImageFormatException being thrown.
The error thrown typically looks like
System.DllNotFoundException: Unable to load DLL 'sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Microsoft.Data.Sqlite.Interop.NativeMethods.sqlite3_open_v2(IntPtr filename, Sqlite3Handle& ppDb, Int32 flags, IntPtr vfs)
at Microsoft.Data.Sqlite.Interop.NativeMethods.sqlite3_open_v2(String filename, Sqlite3Handle& ppDb, Int32 flags, String vfs)
at Microsoft.Data.Sqlite.SqliteConnection.Open()
at <StartupCode$FSI_0009>.$FSI_0009.main#() in E:\BitSync\NonGitProjects\SQLiteSandbox\Microsoft.DataSandbox\Scripts\Script1.fsx:line 7
Demo gist
Has anyone found a solution to this? SQLite works just fine in compiled F# programs and in debug mode.
The artice Loading Native DLLs in F# Interactive has correct techniques for solving the problem of loading native DLLS.
In my case in my case I successfully tried
System.Environment.CurrentDirectory <- #"D:\Projects\SQLiteSandbox\SQLiteSandbox\bin\Debug\x86"
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 :)
I refered npgsql.dll usign: -r:../../Bin/Npgsql.dll.
The C# assembly does not give any errors.
When executing the following code:
NpgsqlConnection conn = new Npgsql.NpgsqlConnection("Server=localhost;database=myDatabase;uid=myName;password=myPassword;pooling=False;CommandTimeout=60;Timeout=60; Preload Reader = true;");
conn.Open();
I get the following error:
Npgsql.NpgsqlConnection doesn't implement interface System.Collections.IEnumerator
Stacktrace:
at Comparator.PairwiseAlignment.fetchData (BaseElements.Sample) <0x0011b>
at Comparator.PairwiseAlignment.initiate (object) <0x00017>
at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff>
Native stacktrace:
mono() [0x4983a9]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xf030) [0x7f12b9f22030]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35) [0x7f12b9bba475]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x180) [0x7f12b9bbd6f0]
mono() [0x5cfcdf]
mono() [0x5cfd62]
mono() [0x49a06f]
mono() [0x49a784]
[0x4159cbba]
Debug info from gdb:
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Remarkable is that the assembly done by the ASP.NET framework does not cause this error when attempting to connect to the database. But it does when I compile the program manualy via the command line. That makes me think the error is probably caused by some compatibility issue.
The ASP Web.config contains this line:
<compilation debug="false" targetFramework="4.0"/>
Therefor I compile via the command line with the "dmcs" module, which stands for version 4.
I was missing a .dll called "Mono.Security.dll".
Remarkable is that ASP.NET didn't include this file with the assembly neither. Still the system was able to function without it..
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.