Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, March 23, 2011 5:03:02 AM(UTC)

dhvik  
dhvik

Groups: Registered
Posts: 9


Hi!
I'm developing a web application using LeadTools (v17.0.0.10) (.net v4) running on IIS7 (64bit)
When I try to load the LeadTools dll:s i get a strange exception (see below).


It seems that it is the Leadtools dll:s that has some initialization code that don't work well in my environment and I wonder wy?
The Microsoft.IdentityModel.dll is placed in the bin folder of the web application (just like the Leadtools.dll:s).


If I run this outside IIS7 i dont get the problem and if I add the Microsoft.IdentityModel.dll to the GAC and remove it from the bin folder it works fine.
All other parts of the website functions without any problems (even functions using Microsoft.IdentityModel.dll).


Do you have any ideas?

/Dan


Server Error in '/MyApp' Application.
--------------------------------------------------------------------------------

Unable to find assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
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.Runtime.Serialization.SerializationException: Unable to find assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Source Error:


Line 110:
Line 111: //use converter to convert the image
Line 112: var content = converter.Convert(sourceReference, targetConversion);
Line 113: //copy values from targetReference
Line 114: if (string.IsNullOrEmpty(content.Name))


Source File: C:\VSS\TFS\MyCompany - MyApp\Development4\MyApp.Core.Service\MediaConversionService.cs Line: 112

Stack Trace:


[SerializationException: Unable to find assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +4767763
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +1725
System.AppDomain.get_Id() +0
.DoCallBackInDefaultDomain(IntPtr function, Void* cookie) +159
.LanguageSupport._Initialize(LanguageSupport* ) +517
.LanguageSupport.Initialize(LanguageSupport* ) +204

[ModuleLoadException: The C++ module failed to load while attempting to initialize the default appdomain.
]
.LanguageSupport.Initialize(LanguageSupport* ) +491
.cctor() +33

[TypeInitializationException: The type initializer for '' threw an exception.]
.ThrowModuleLoadException(String , Exception ) +0
.LanguageSupport.Initialize(LanguageSupport* ) +328
.cctor() +33

[TypeInitializationException: The type initializer for '' threw an exception.]
MyApp.Core.Conversion.LeadToolsConverter.Convert(MediaContentReference sourceReference, MediaConversion targetConversion) +0
MyApp.Core.Service.MediaConversionService.PerformConversion(MediaContentReference sourceReference, MediaContentReference targetReference) in C:\VSS\TFS\MyCompany - MyApp\Development4\MyApp.Core.Service\MediaConversionService.cs:112
MyApp.Core.Service.MediaContentService.CreateContent(MediaContentReference reference) in C:\VSS\TFS\MyCompany - MyApp\Development4\MyApp.Core.Service\MediaContentService.cs:84
MyApp.Core.Service.MediaContentService.GetOrCreateContent(MediaContentReference reference, Int64 offset, Int64 length) in C:\VSS\TFS\MyCompany - MyApp\Development4\MyApp.Core.Service\MediaContentService.cs:141
MyApp.Core.Service.MediaContentService.GetMediaContent(String mediaContentId, Int64 offset, Int64 length) in C:\VSS\TFS\MyCompany - MyApp\Development4\MyApp.Core.Service\MediaContentService.cs:53
MyApp.UI.Mvc.Controllers.MediaController.FetchMedia(String mediaContentId, String name) in C:\VSS\TFS\MyCompany - MyApp\Development4\MyApp.UI.Mvc\Controllers\MediaController.cs:18
lambda_method(Closure , ControllerBase , Object[] ) +179
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, March 23, 2011 1:21:34 PM(UTC)

Danny H  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Hello Dan,

In order to assist you further I am going to need you to answer these questions.

1. How are you using LEADTOOLS? Does this happen after you make a certain call?

2. Are you sure you are using the correct platform version of the LEAD DLLs? x64 or x86
with Enable Windows 32 Applications set to true in the app pool.

3. Are you manually creating any threads? Keep in mind in IIS when a thread is created,
the binaries are copied to a temporary folder

4. Is there a way to catch that exception and dump the current directory? Is IdentityModel
DLL being copied there?

5. Would AppDomain.AssemblyResolve help you in any way?
 
#3 Posted : Thursday, March 24, 2011 12:03:17 AM(UTC)

dhvik  
dhvik

Groups: Registered
Posts: 9


Hi!
1. I use leadtools like below. A normal resize operation of an image (some plumbing code has been removed to only include the leadtools code)


public MediaContent Convert(MediaContentReference sourceReference, MediaConversionBase targetConversion) {
...
byte[] data = content.Content;
BinaryMediaContent outputContent;

RasterCodecs.Startup();
RasterCodecs codec = null;
RasterImage image = null;
try {

codec = new RasterCodecs();
using (var imageStream = new MemoryStream(data, false)) {

image = codec.Load(imageStream);

//applyes the effect to all the frames in the image
Size size = ResizeUtil.GetImageSize(image.Width, image.Height, format);
var cmd = new SizeCommand(size.Width, size.Height, RasterSizeFlags.Bicubic);
cmd.Run(image);
}
using (var outputStream = new MemoryStream()) {
codec.Save(image, outputStream, image.OriginalFormat, image.BitsPerPixel);
outputContent = new BinaryMediaContent(outputStream.ToArray());
}
} finally {
if (image != null) { image.Dispose(); }
if (codec != null) { codec.Dispose(); }
RasterCodecs.Shutdown();
}
return outputContent;
}
The exception occurs on the last row!! wich seems a bit akward, no speciall call just the } after the return statement...
The call to the Convert method comes from another assembly (MyApp.Service.dll) though. The Convert method resides in the assembly MyApp.Conversion.dll and this is the only assembly that references the leadtools assemblies.

2. We are using the 64 bit version of the leadtools dll:s and the AppPool running the application (IIS7) is using Enable 32bit winapp to false.
3. We don't manually create any threads.
4. Current dir is c:\windows\system32\inetsrv
5. No, AssemblyResolve don't get this info, perhaps the leadtools loading happens in another appdomain (i'm only monitoring the webapplications appdomain (via global.asax))
/Dan
 
#4 Posted : Thursday, March 24, 2011 10:49:51 AM(UTC)

Danny H  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)


This does not appear to be a LEADTOOLS related issue. If you can show that it is in fact
an issue with LEADTOOLS, we will gladly look further into this.
 
#5 Posted : Friday, March 25, 2011 3:33:13 AM(UTC)

dhvik  
dhvik

Groups: Registered
Posts: 9


Hi!
It seemed like all < and > was stripped from the stacktrace but infact the stacktrace points to the Leadtools.Codec.dll assembly
If I analyse the stacktrace and writes the Source and TargetSite for the nested exceptions we can clearly see that the inner exceptions comes from
MyApp.Core.Conversion - Leadtools.Codecs - msvcm90 - mscorlib

Message: Unable to find assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Source: mscorlib
TargetSite: GetAssembly
DeclaringType: System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo
DeclaringTypeAssembly: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
######################################
[SerializationException: Unable to find assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +4767763
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +1725
System.AppDomain.get_Id() +0
<CrtImplementationDetails>.DoCallBackInDefaultDomain(IntPtr function, Void* cookie) +159
<CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* ) +517
<CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* ) +204

Message: The C++ module failed to load while attempting to initialize the default appdomain.

Source: msvcm90
TargetSite: <CrtImplementationDetails>.LanguageSupport.Initialize
######################################
[ModuleLoadException: The C++ module failed to load while attempting to initialize the default appdomain.
]
<CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* ) +491
.cctor() +33

Message: The type initializer for '<Module>' threw an exception.
Source: Leadtools.Codecs
TargetSite: <CrtImplementationDetails>.ThrowModuleLoadException
######################################
[TypeInitializationException: The type initializer for '<Module>' threw an exception.]
<CrtImplementationDetails>.ThrowModuleLoadException(String , Exception ) +0
<CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* ) +328
.cctor() +33

Message: The type initializer for '<Module>' threw an exception.
Source: MyApp.Core.Conversion
TargetSite: Convert
DeclaringType: MyApp.Core.Conversion.LeadToolsConverter
DeclaringTypeAssembly: MyApp.Core.Conversion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
######################################
[TypeInitializationException: The type initializer for '<Module>' threw an exception.]
MyApp.Core.Conversion.LeadToolsConverter.Convert(MediaContentReference sourceReference, MediaConversionBase targetConversion) in C:\VSS\TFS\MyCompany - MyApp\Development4\MyApp.Core.Conversion\LeadToolsConverter.cs:173
MyApp.Core.Service.MediaConversionService.PerformConversion(MediaContentReference sourceReference, MediaContentReference targetReference) in C:\VSS\TFS\MyCompany - MyApp\Development4\MyApp.Core.Service\MediaConversionService.cs:131

 
#6 Posted : Monday, March 28, 2011 11:37:03 AM(UTC)

Danny H  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

I have looked into this further and have found a few things that would still point that this is not necessarily a Leadtools issue. Also note that we make no calls to the Microsoft.IdentityModel.dll which appears to be the real root.

It does appear to be a common problem when working with IIS. One of the possible reasons is a cross-appdomain failure.

If you want to create a small sample application that replicates this issue so we can test it on our end and send it to support@leadtools.com. Then we will gladly investigate it further.
 
#7 Posted : Friday, April 1, 2011 12:26:38 AM(UTC)

dhvik  
dhvik

Groups: Registered
Posts: 9


I can reproduce this error using a standalone web application that uses two modules from the Microsoft.IdentityModel framework. If i remove these from the web.config file it works fine, but if they are present when the application starts I get the the error.(need to iisreset between).

To reproduce:
Extract LeadtoolsMvcTest.rar to a folder (c:\test)

Create one application pool, LeadToolsTestAppPool
Running on .net 4, integrated mode, enable32bit applications false

Create a new Web site in the IIS and
• Use the LeadToolsTestAppPool
• Point to the LeadtoolsMvcTest folder (c:\test\leadtoolsMvctest)

Navigate to the website and get the error.

/Dan
File Attachment(s):
LeadtoolsMvcTest.rar (4,007kb) downloaded 32 time(s).
 
#8 Posted : Friday, April 1, 2011 4:28:51 AM(UTC)

Danny H  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Hi Dan,

I just downloaded your example project, and I have a few questions about it.

What version of Visual Studio was this built in as it is not opening on my end?

Also, were you intending to deploy in .NET 4 while using our .NET 2.0 DLLs? I noticed that the versions of the Leadtools dlls are not .NET 4.

Lastly, are the C++ runtime files installed on the deployment machine as we do rely on them to be installed?
 
#9 Posted : Friday, April 1, 2011 6:33:52 AM(UTC)

dhvik  
dhvik

Groups: Registered
Posts: 9


I use VisualStudio 2010 and have the Mvc3 framework installed as well (I think there is some plugin that defines this project ( http://www.asp.net/mvc/mvc3 ))

I haven't reconsidered this to be an issue but I can switch to the .4 versions of the Leadtools dll:s.

Wich c++ runtime files do you refer to?
 
#10 Posted : Friday, April 1, 2011 6:50:59 AM(UTC)

Danny H  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

I would like you to refer to this link regarding the Microsoft C/C++ runtime files, which will be 2008.

http://www.leadtools.com/help/leadtools/v17/dh/TO/Leadtools.Topics~Leadtools.Topics.FilesToBeIncludedWithYourApplication.html

I am going to be getting this plugin and running a test on your application to verify other possible solutions, but do try installing the runtime if they are not present. The .NET 4.0 dlls could be the root of the problem, but if this only occurs in deployment on IIS7 something is probably missing.
 
#11 Posted : Friday, April 1, 2011 12:03:23 PM(UTC)

dhvik  
dhvik

Groups: Registered
Posts: 9


Hi!
I have those runtime files on the server. The Leadtools conversion do work if I comment the two modules in the web.config file so it has to be something else.
I guess that the problem is the combination of Leadtools and Microsoft.IdentityModel.dll that somehow generates this exception.
 
#12 Posted : Friday, April 1, 2011 12:50:05 PM(UTC)

Danny H  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

I wanted to post an update on this issue. I have looked into this further and you do need to have the runtime files installed on the deployment machine, but also that does not appear to be the issue in this case. Though they were necessary they did not propose the same issue. This issue was directly involved with using the wrong Leadtools DLLs.

With the runtime files installed and the Leadtools DotNet2 32bit DLLs installed to the IIS website I had the same error. When changing to the appropriate 64bit DotNet4 dlls which was the target framework for this. The issue was resolved.

 
#13 Posted : Sunday, April 3, 2011 10:46:27 AM(UTC)

dhvik  
dhvik

Groups: Registered
Posts: 9


Hi Danny,
switching to the .net 4 files and installing the c++ 2010 runtime files did the trick.
It seemed that the .net 2 dlls worked as long as I didnt use the identitymodel dll (the two fedauth modules) so it had to be some weird combo issue.
Using the .net 4 dll:s works fine for me anyway so I don't need to look into the other issue any more.
Thanks for accurate and helpful support.
/Dan
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.241 seconds.