Configuring Fluent NHibernate with System.Data.OracleClient - c#

I'm trying to use System.Data.OracleClient instead of Oracle.DataAccess with Fluent Nhibernate . From what I understand, in order to achieve this I should change my driver from OracleDataClientDriver to OracleClientDriver. I've configured it like below, but I get an error that looks like it is still trying to use OracleDataClientDriver. What am I doing wrong?
FluentConfiguration configuration = Fluently.Configure()
.Database(
OracleDataClientConfiguration.Oracle10
.ConnectionString(x => x.FromConnectionStringWithKey(connString))
.Provider<NHibernate.Connection.DriverConnectionProvider>()
.Driver<NHibernate.Driver.OracleClientDriver>()
)
Here is the error, it is still looking for Oracle.DataAccess which I'm trying to get away from.
[NullReferenceException: Object reference not set to an instance of an object.]
NHibernate.Driver.OracleDataClientDriver..ctor() +134
[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) +113
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232
System.Activator.CreateInstance(Type type, Boolean nonPublic) +83
System.Activator.CreateInstance(Type type) +6
NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type type) +58
NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings) +194
[HibernateException: Could not create the driver from NHibernate.Driver.OracleDataClientDriver, NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.]
NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings) +334
NHibernate.Connection.ConnectionProvider.Configure(IDictionary`2 settings) +233
NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary`2 settings) +558
NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary`2 properties) +1328
NHibernate.Cfg.Configuration.BuildSettings() +85
NHibernate.Cfg.Configuration.BuildSessionFactory() +102
FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() +72

Use OracleClientConfiguration and OracleClientDriver instead of OracleDataClientConfiguration and OracleDataClientDriver
FluentConfiguration configuration = Fluently.Configure()
.Database(
OracleClientConfiguration.Oracle10
.ConnectionString(x => x.FromConnectionStringWithKey(connString))
.Provider<NHibernate.Connection.DriverConnectionProvider>()
.Driver<NHibernate.Driver.OracleClientDriver>()
)
The comments in the question solved my problem. I've posted this answer for the benefit of others, #PapaBurgundy & #Rivarolle deserve full credit for the answer.

Related

C# 8000401a The server process could not be started because the configured identity is incorrect

I'm trying to use the office component to convert a excel file to a pdf file ,but I get the exception as blow
<exception><![CDATA[System.Runtime.InteropServices.COMException (0x8000401A): Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 8000401a The server process could not be started because the configured identity is incorrect. Check the username and password. (Exception from HRESULT: 0x8000401A).
at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)
at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType)
at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
]]></exception>
However,when I restart the IIS ,everything is ok.And almost two days later,The Exception appear again.

The DLL "vsperf140.dll": the specified module could not be found

Today I made a new build of my web-application (simple aspx-web-application). When I tried to load it on my server into IIS and navigated to the startpage I got following exception:
Die DLL "vsperf140.dll": Das angegebene Modul wurde nicht gefunden.
(Ausnahme von HRESULT: 0x8007007E) kann nicht geladen werden.
(means: the DLL "vsperf140.dll": the specified module could not be found.)
also the stacktrace doesn't help me a lot:
[DllNotFoundException: Die DLL "vsperf140.dll": Das angegebene Modul
wurde nicht gefunden. (Ausnahme von HRESULT: 0x8007007E) kann nicht
geladen werden.] _CAP_Enter_Function_Managed(Int32 , Int32 , Int32
) +0 ASP.global_asax..ctor() +23
[TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler
verursacht.] 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) +113
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly,
Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
+232 System.Activator.CreateInstance(Type type, Boolean nonPublic) +83 System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes, StackCrawlMark& stackMark) +1122
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes) +128 System.Activator.CreateInstance(Type
type, BindingFlags bindingAttr, Binder binder, Object[] args,
CultureInfo culture) +18
System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[]
args) +60
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr
appContext, HttpContext context) +260
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
appContext) +296
[HttpException (0x80004005): Ein Aufrufziel hat einen Ausnahmefehler
verursacht.] System.Web.HttpRuntime.FirstRequestInit(HttpContext
context) +9930568
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
+101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +254
any idea what the problem could be? Searched in google - but seems that nobody knows something about that vsperf140.dll...
From the OP in a comment:
Seems like this came with the performance profiler. Removing the project and pulling it from TFS again solved my issue.
Removed the references of AspNetHelper in web.config.
Rebuild the whole application and then deployed to new packages on my server.
(Removing the AspNetHelper in web config directly in server didn't solve my issue)

System.IO.FileLoadException with WebService

I'm using Visual Studio 2013 and I am trying to create a webservice using the assembly DNSTools from Nuance SDK. My WebMethod is really simple : I just create an object from a DNSTools' class, then return "Hello World".
using DNSTools;
namespace WebTestFinal
{
public class WebServiceTestFinal : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
DgnDictCustom dgn = new DgnDictCustom();
return "Hello World";
}
However when I reach the line :
DgnDictCustom dgn = new DgnDictCustom();
It throws me this error :
System.IO.FileLoadException: Retrieving the COM class factory for component with CLSID {A0E850E3-91DB-11D1-96DC-0080C72FD13C} failed due to the following error: 8007045a. A dll initialization routine failed. (Exception of HRESULT : 0x8007045A).
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at WebTestFinal.WebServiceTestFinal.HelloWorld()
I did some research and found out that System.IO.FileLoadException was thrown because an assembly cannot be loaded. Despite using Fuslogvw.exe and Process Monitor I can't find which assembly is the root of the problem.
Go to Project Properties and in Build Tab, select X86 for platform target, and if it's already X86 change de to 64
In VS - project properties - in the Build tab - platform target =X86

MVC Application - Retrieve the LoaderExceptions from Global.asax.cs

I am getting the following error when trying to implement code from my peers:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
I see there is a posting for how to "How to retrieve the LoaderException property?" here (How to retrieve the LoaderException property?)
But, I do not understand where this try catch should go since the code to implement my peers code is in the Global.asax.cs file. (see below)
Any help would be appreciated and if you DOWN VOTE me, please explain why.
namespace IMS_STS_Example_SIT
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : StsMvcHttpApplication
{
protected override void OnApplicationStarted()
{
base.OnApplicationStarted();
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
Here is the full error message from the UI:
[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
MyCompNameIT.Common.Utils.Installer.ConfigInstaller.Install(IWindsorContainer container, IConfigurationStore store) in C:\MyCompNameProjects\PrideLands\Common\Main\Source\MyCompNameIT.Common\MyCompNameIT.Common.Utils\Installer\ConfigInstaller.cs:80
Castle.Windsor.WindsorContainer.Install(IWindsorInstaller[] installers, DefaultComponentInstaller scope) +200
Castle.Windsor.WindsorContainer.Install(IWindsorInstaller[] installers) +144
MyCompNameIT.Common.Utils.InstallerExtension.WithMyCompNameDefaults(IWindsorContainer container) in C:\MyCompNameProjects\PrideLands\Common\Main\Source\MyCompNameIT.Common\MyCompNameIT.Common.Utils\InstallerExtension.cs:52
MyCompNameIT.Common.Web.InstallerExtension.WithMyCompNameWebMvc(IWindsorContainer container) in C:\MyCompNameProjects\PrideLands\Common\Main\Source\MyCompNameIT.Common\MyCompNameIT.Common.Web\InstallerExtension.cs:20
MyCompNameIT.Common.Web.MvcHttpApplication..cctor() in C:\MyCompNameProjects\PrideLands\Common\Main\Source\MyCompNameIT.Common\MyCompNameIT.Common.Web\IocHttpApplication.cs:30
[TypeInitializationException: The type initializer for 'MyCompNameIT.Common.Web.MvcHttpApplication' threw an exception.]
MyCompNameIT.Common.Web.MvcHttpApplication..ctor() +0
IMS_STS_Example_SIT.MvcApplication..ctor() +40
ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\ims_sts_example_sit\2c6588da\447046b5\App_global.asax.lkasnsc6.0.cs:0
[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.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +14429965
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +200
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +28
System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +83
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +312
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) +12881108
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12722297
replace StsMvcHttpApplication by MvcHttpApplication or make sure you are refering to StsMvcHttpApplication assemblies and all their dependencies

.Net 3.5 App Start Error

I have .net 3.5 app that I built in VS 2008. App works fine on my pc and other pc's i have tried. I have also published on several other production servers.
But my app on a particular server does not work. I have checked permissions, gave them to iisusrs, network service. Tried running process mon. but no luck. Would appreciate if somebody can help me.
[NullReferenceException: Object reference not set to an instance of an
object.] Project.Global..cctor() +500
[TypeInitializationException: The type initializer for
'Product.Global' threw an exception.] Project.Global..ctor() +0
ASP.global_asax..ctor() in
c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET
Files\Project\5b298990\c958346b\App_global.asax.aqngqd-g.0.cs:0
[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) +146 System.RuntimeType.CreateInstanceImpl(Boolean
publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +298
System.Activator.CreateInstance(Type type, Boolean nonPublic) +79
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder
binder, Object[] args, CultureInfo culture, Object[]
activationAttributes) +10371979
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr
appContext, HttpContext context) +258
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
appContext) +382
[HttpException (0x80004005): Exception has been thrown by the target
of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11411878
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +4401140
The static constructor for Product.Global is raising a NullReferenceException. This is likely due to some hard coded value that is different or unavailable on that system.
Potential candidates would be localization issues (trying to parse strings in the wrong culture) causing a value to not be initialized, a missing configuration value, or anything else that is occurring within the static initialization of that type.

Categories

Resources