Strange Castle AddFacility runtime error - nhibernate

I'am new to Castle and Castle.Windsor, so this is maybe a noob question.
I created an empty console .NET 4.0 application and added next packages through NuGet:
Castle Windsor factory support facility 3.0 beta 1 (3.0.2001)
Castle Windsor 3.0 beta 1 (3.0.2001)
Castle Core 3.0 beta 1 (3.0.2001)
Castle NHibernate facility (0.5.1.4000)
Fluent NHibernate (1.3.0.717)
NHibernate (3.2.0.4000)
Iesi Collections (3.2.0.4000)
and wrote next code:
static void Main(string[] args)
{
IWindsorContainer container = new WindsorContainer();
container.AddFacility<AutoTxFacility>();
//container.AddFacility<NHibernateFacility>();
}
But I got an error:
GenericArguments[0], 'TService', on 'Castle.MicroKernel.Registration.RegistrationGroup`1[S]' violates the constraint of type parameter 'S'.
If rewrite code and uncomment second AddFacility line:
static void Main(string[] args)
{
IWindsorContainer container = new WindsorContainer();
//container.AddFacility<AutoTxFacility>();
container.AddFacility<NHibernateFacility>();
}
I got next error:
Could not load type 'Castle.Facilities.FactorySupport.FactorySupportFacility' from assembly 'Castle.Windsor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'.
I tried add container.AddFacility<Castle.Facilities.FactorySupport.FactorySupportFacility>(); line before first AddFacility but it not solve a problem.
In real application I got another error for same try and same libraries:
Could not load file or assembly 'Castle.Windsor, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
with next FusionLog:
=== Pre-bind state information ===
LOG: DisplayName = Castle.Windsor, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc
(Fully-specified)
LOG: Appbase = file:///xxx.Test/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : Castle.Facilities.AutoTx, Version=3.0.202.2202, Culture=neutral, PublicKeyToken=407dd0808d44fbdc.
LOG: This bind starts in default load context.
LOG: Using application configuration file: xxx.Test\bin\Debug\xxx.Test.dll.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Castle.Windsor, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc
LOG: Attempting download of new URL file:///xxx.Test/bin/Debug/Castle.Windsor.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
I don't understand what I doing wrong.

This looks like the version of AutoTx facility you're using was compiled against older version of Windsor.
I'm not sure if the facility supports Windsor 3 yet, probably the best course of action is to ask at castle user googole group

Related

ASP.NET Register Assembly error

I am WAY out of my league here, so I apologize if I'm asking a duplicate question, but I don't know where to start on this one.
I recently migrated an SQL database from SERVER1, where it was collocated with IIS hosting the web interface to access the database, to SERVER2. The web interface is now accessing the database properly, and through some application features I can access the data properly, with no error. However, when I try to run a report, I get this error:
How do I fix this?
Server Error in '/' Application.
--------------------------------------------------------------------------------
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 5: Namespace="AjaxControlToolkit"
Line 6: TagPrefix="ajaxToolkit" %>
Line 7: <%# Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Line 8: Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
Line 9:
Source File: /source/Report5.aspx Line: 7
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.4028
UPDATE
I turned on logging and got this more detailed error:
=== Pre-bind state information ===
LOG: User = AURORAFCS\raj
LOG: DisplayName = Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///C:/Family/
LOG: Initial PrivatePath = C:\Family\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Family\web.config
LOG: Using host configuration file: \\?\c:\windows\microsoft.net\framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms.EXE.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.EXE.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms.EXE.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.EXE.
UPDATE2
Using fusion logger, I have this more detailed message, which shoes it a is a "File Cannot Be Found" error. However, I have installed the redistributables, so why can it not find the DLL?
*** Assembly Binder Log Entry (11/21/2014 # 4:00:35 PM) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = AURORAFCS\raj
LOG: DisplayName = Microsoft.ReportViewer.WebForms, Version=8.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Partial)
LOG: Appbase = file:///C:/Family/
LOG: Initial PrivatePath = C:\Family\bin
LOG: Dynamic Base = c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\dc46260e
LOG: Cache Base = c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\dc46260e
LOG: AppName = 807e5b0d
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Family\web.config
LOG: Using host configuration file: \\?\c:\windows\microsoft.net\framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms.EXE.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.EXE.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms.EXE.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.EXE.
LOG: All probing URLs attempted and failed.
You need to determine what version of the ReportViewer Control you are targeting and install the proper package on the same server that your web app is deployed.
Microsoft Report Viewer 2010 Redistributable Package
Microsoft Report Viewer 2008 SP1 Redistributable
Microsoft Report Viewer Redistributable 2008
Microsoft Report Viewer Redistributable 2005
I am sure the logic is as follows:
ReportViewer 2010 can be used against SQL Server 2008(SP2) and 2012
ReportViewer 2008 can be used against SQL Server 2008 and 2005
ReportViewer 2005 can be used against SQL Server 2005
I found the answer to my problem in this blog:
http://www.orcsweb.com/blog/desiree/access-report-viewer-dll-files-for-your-application/
I just extracted the needed DLL and put it into one of the directories that the webapp was looking for. Still not sure why it happened, though.

docx4j.NET installation issue

I've installed docx4j.NET 3.0.1 from Nuget with vs2012.
When I try to use the library with this call
WordprocessingMLPackage.load(inputS, "");
I receive this error:
System.TypeInitializationException:
The type initializer for 'org.docx4j.openpackaging.packages.OpcPackage' threw an exception.
---> System.IO.FileNotFoundException: Could not load file or assembly 'slf4j-api,
Version=1.7.6.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies
The version of slf4j-api in the docx4j.net 3.0.1 distribution is 1.7.5.0.
Is there a problem in the distribution of package?
Check that the list of referenced DLLs in your VS project includes slf4j-api. If not, add it.
If you have the DLL properly referenced, then as per the sample code in say https://github.com/plutext/docx4j.NET/blob/master/docx4j.NET/src/samples/c%23/Docx4NET/DocxToHTML.cs, you might need something like (note the bottom line):
// Programmatically configure Common Logging
// (alternatively, you could do it declaratively in app.config)
NameValueCollection commonLoggingproperties = new NameValueCollection();
commonLoggingproperties["showDateTime"] = "false";
commonLoggingproperties["level"] = "INFO";
LogManager.Adapter = new Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter(commonLoggingproperties);
ILog log = LogManager.GetCurrentClassLogger();
log.Info("Hello from Common Logging" );
// Necessary, if slf4j-api and slf4j-NetCommonLogging are separate DLLs
ikvm.runtime.Startup.addBootClassPathAssembly(
System.Reflection.Assembly.GetAssembly(
typeof(org.slf4j.impl.StaticLoggerBinder)));

Upgrading App from .NET 3.5 to 4.0, COM fails now

I have an application that I am upgrading from the .NET 3.5 to the .NET 4.0 framework. It uses a COM library which is referenced. It works no problem in 3.5 but after converting to 4.0 I have issues getting the COM to work. The COM is from a 3rd party so we didn't develop it ourselves.
I get the following COM error (generic COM error, not specific to the COM object itself): hr = 0x8007000b
CLR gives me: 'The invocation of the constructor on type 'Skype_Business_Launcher.Main' that matches the specified binding constraints threw an exception.' Line number '3' and line position '5'.
And the C# logs:
=== Pre-bind state information ===
LOG: User = \phillip
LOG: DisplayName = Interop.SKYPE4COMLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : Skype Business Launcher, Version=1.0.5.0, Culture=neutral, PublicKeyToken=null.
LOG: This bind starts in default load context.
LOG: Using application configuration file:
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///bin/Debug/Interop.SKYPE4COMLib.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
I removed the pathname for security reasons but I have checked all the path information and it's all correct. Also the COM library file exists where it's pointing to. It's also copied to the OBJ folder within the project as well.
Originally I was getting an error about the COM library not supporting embedded types so I made "Embed Interop Types" false (it was true below) and the error went away but I'm not sure if thats connected to this error or not so I thought I'd mention it just in case.
Again, it works just fine with 3.5.
Thanks,
A shot in the dark: it looks like you are using the x64 version of the framework. Was that already the case with 3.5 ? And is the COM server a DLL or an EXE ?
If the COM server is a DLL, there needs to be a "bitness" match between the DLL and your program.
when you convert your project to 4.0 the IDE can perform a issue to convert COM library into 4.0.
when you convert your project to 4.0 remove com library then Re include it in your project then i thing it should be works.

Problem running latest version of nhibernate

I downloaded latest version of NHibernate “2.1.0.2002”.
It built fine, but when I run my unit tests, I keep getting error :-
System.IO.FileLoadException: Could not load file or assembly 'NHibernate, Version=2.0.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
It looks like somewhere it looks of old version.
Here is link
https://stackoverflow.com/questions/839112/problem-while-migrating-nhibernate-to-higher-version
This is internal error I am getting:
=== Pre-bind state information ===
LOG: DisplayName = NHibernate, Version=2.0.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
(Fully-specified)
LOG: Appbase = file:///D:/Project Files/CIS3G/Webapp/_Test_DAL/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : CIS3G.DAL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Project Files\CIS3G\Webapp\_Test_DAL\bin\Debug\_Test_DAL.dll.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: NHibernate, Version=2.0.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
LOG: Attempting download of new URL file:///D:/Project Files/CIS3G/Webapp/_Test_DAL/bin/Debug/NHibernate.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Please check if you set the Specific Version-Property on your NHibernate Reference to 'true'? It doesn't seem to be the case on this error but with new NHibernate you need to provide an external ByteCodeProvider like Linfu.dll as well. Please check this also.
I've run into this before.
In my case the problem was that I was using a UnitOfWork implementation for handling Nhibernate sessionFactories.
I've been using this lib for a while so I just copied the compiled dll to a new test project with the new version of NHibernate, so I got the version problem.

Appbase being set to nothing at runtime

I have a difficult to reproduce error on about three user installs out of 20. This is a .net Windows application, 2005 in VB.Net running on XP. After opening up a window, we get an error:
Could not load file or assembly 'Infragistics2.Win.UltraWinChart.v8.2,
Version=8.2.20082.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb' or one of its
dependencies. Element not found. (Exception from HRESULT: 0x80070490) *****ClearTrac *****
at ClearTrac.ucNav.InitializeComponent()
at ClearTrac.ucNav..ctor()
at ClearTrac.frmPortfolio.InitializeComponent() ...
This happens also for the ReportViewer dll and a couple other infragistics dll's.
I turned on Bind Logging, and the first binds are ok, but when I get the error, the Appbase has been set to blank:
*** Assembly Binder Log Entry (2/20/2009 # 3:41:10 PM) ***
The operation failed.
Bind result: hr = 0x80070490. Element not found.
Assembly manager loaded from: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Documents and Settings\rdelaney\Local Settings\Apps\2.0\ZZ09GJK6.2VY\GPRTP6CM.GOX\clea..tion_8055aae51715540e_0001.0004_0a540274bbdc609c\ClearTrac.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = CAM\rdelaney
LOG: DisplayName = Microsoft.ReportViewer.WinForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase =
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = ClearTrac.exe`
Calling assembly : ClearTrac, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Documents and Settings\rdelaney\Local Settings\Apps\2.0\ZZ09GJK6.2VY\GPRTP6CM.GOX\clea..tion_8055aae51715540e_0001.0004_0a540274bbdc609c\ClearTrac.exe.config
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80070490).
Any ideas?
You should check that on problematic computers the Microsoft.ReportViewer.WinForms is either in GAC or in application directory.
If it's not, you should install Microsoft Report Viewer redistributable on problematiuc computers.
http://www.microsoft.com/downloads/details.aspx?FamilyID=cc96c246-61e5-4d9e-bb5f-416d75a1b9ef&displaylang=en
We found this error only happens under the .net Framework with SP1 or SP2 installed. With the bare .net framework 2.0 installed, it does not happen.