Jump to content
byunminsung

'mixed Mode Assembly Is Built Against Version 'v2.0.50727' Of The Runtime And Cannot Be Loaded In The 4.0 Runtime

Recommended Posts

byunminsung

Hi,

I am getting the below error when I run "Library lib = new Library();".

 

A ''System.IO.FileLoadException'' was thrown from the .NET AppDomain ''PTS_Beta_Print'' to the broker from the source ''Seagull.Security'' with the message ''Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.''.

 

The stack trace for the exception is '' at Seagull.Security.EffectivePermissionsManager..ctor()

at Seagull.Librarian.Core.SecuritySupport.get_SecurityManager()

at Seagull.Librarian.Core.SecuritySupport.ValidatePermission(SecurityApplication application, SecurityPermission permission)

at Seagull.Librarian.Core.SecuritySupport.ValidatePermission(SecurityPermission permission)

at Seagull.BarTender.Librarian.Library..ctor()

 

I have tried to compile with the below but had no luck.

<startup useLegacyV2RuntimeActivationPolicy="true">

<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>

 

stack trace seems to indicate this has something to do with security setting(?).

Please give your advice on this problem.

Share this post


Link to post
Share on other sites
byunminsung

I have resolved the issue by placing app.config where the first appDomain created.

Share this post


Link to post
Share on other sites
byunminsung

I am trying to create WCF service using BarTender SDK. application is working fine in dev env( development server) but if I deploy it into IIS I am getting below response.

 

Server Error in '/' Application.

Could not load file or assembly 'Seagull.BarTender.Print' or one of its dependencies. An attempt was made to load a program with an incorrect format.

 

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.BadImageFormatException: Could not load file or assembly 'Seagull.BarTender.Print' or one of its dependencies. An attempt was made to load a program with an incorrect format.

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.

Assembly Load Trace:

The following information can be helpful to determine why the assembly 'Seagull.BarTender.Print' could not be loaded.

 

[badImageFormatException: Could not load file or assembly 'Seagull.BarTender.Print' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +567
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +192
   System.Reflection.Assembly.Load(String assemblyString) +35
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +123

[ConfigurationErrorsException: Could not load file or assembly 'Seagull.BarTender.Print' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11569328
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +485
   System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +79
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +337
   System.Web.Compilation.BuildManager.CallPreStartInitMethods() +280
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1167

[HttpException (0x80004005): Could not load file or assembly 'Seagull.BarTender.Print' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11702064
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4870277

 

any idea?

Share this post


Link to post
Share on other sites
Domingo R - Seagull Support

Are you using a Trial Edition or full license of BarTender? If you're using a Trial Edition, let me know how many Trial days are left under the "Help > About" dialog of BarTender apart from the version and build in use. If you've a full license of BarTender, what exact Edition, version and build of BarTender is in use?

 

Also, on which version and service pack of Windows are you running?

 

Does the error message also appear when you open your web based application from a web browser which is opened on the same PC as IIS and BT runs?

 

Is there any chance that you can install our closed product BT-WPS

 

 

Is there any chance for you to install BT-WPS (BarTender Web Print Server) on this same server and let us know if you’ve any problems to run BT-WPS? BT-WPS can be installed as part of BarTender's web installer, so you will just need to modify the BarTender installation under "Programs & Features", and proceed to also install BT-WPS.

Share this post


Link to post
Share on other sites
byunminsung

Here is the info you requested.

 

BarTender
The world's leading software for label, bar code, RFID and card printing.
Edition: Enterprise Automation (3 Printers)
Version: 10.0 SR4
Build: 2868
Activation Status: Activated
 

I am testing this on windows 2008 R2 enterprise(x64) SP1.

I have just installed print server and can access BT-WPS using browser.

 

one difference I noticed is that print server is using V2 .NET framework. and WCF service requires V4 NET framework.

I have a support #. please let me know if you want me to open service ticket for this issue.

Share this post


Link to post
Share on other sites
fredrik.alpner@grace.com

Hi,

I´m trying to deploy a project , and are getting the: ''Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.''.

 

I´ve solved this before by adding
 

startup useLegacyV2RuntimeActivationPolicy="true">

 

app.config file, but then I had Visual studio installed on that PC.  Do I have to put app.config some where after install of the application? Any help would be apprecitated!

 

 

/Fredrik

Share this post


Link to post
Share on other sites
Domingo R - Seagull Support

Fredrik,

 

If you've already compiled your application and made the executable file, no you shouldn't need to put the app.config specially on a specific folder. Have you installed your .NET SDK application on another PC (with BT as well installed on this PC) and have you had any problems? If yes, which problems did you obtain?

Share this post


Link to post
Share on other sites
Domingo R - Seagull Support

"Byunminsung", if the problem still persists then yes, please contact us either by email or phone. Do you get this error message no matter if the application pool under which the web based application runs under a different identity (a different Windows account)?

Share this post


Link to post
Share on other sites
fredrik.alpner@grace.com

will complie some test results ang get back to you. Thanks for responding!

Share this post


Link to post
Share on other sites

×