Could not load type 'System.Drawing.FontStyle' - asp.net

I have a library of classes which work with graphic by system.drowing and web-application on .net core 2. When I try to create object object of class from this lybrary in controller it throws exception
TypeLoadException: Could not load type 'System.Drawing.FontStyle' from assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Please, help to solve problem!

Related

Error 1001. An exception occurred in the OnAfterInstall event handler of a installer.cs class

Currently my Application containing both .net standard and .net framework Application , during the installation of a msi I am getting the below error.
Error 1001. Error 1001. An exception occurred in the OnAfterInstall event handler of Interop.Service.Installer. --> Could not load file or assembly 'System.Diagnostics.EventLog, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
when I am tring to add the System.Diagnostics.EventLog of .net standard library into .net framework app its showing duplication error.
Error CS0433 The type 'EventLogEntryType' exists in both 'System.Diagnostics.EventLog, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' and 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' SPI.Service D:\Cluster01_Test\Process\Service\ServiceInstaller.cs

I am not sure why I am getting this error. Can anyone suggest me the possible ways to debug and run the application please?

---Exception---
Exception Type: System.Exception
Exception Message: Could not load file or assembly 'StatusUpdater, Version=1.0.0.2, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Operation is not supported.

ArrayTypeMismatchException thrown when adding MediaTypeHeaderValue to JsonFormatter.SupportedTypes

I am trying to add a supported type to the JsonFormatter.SupportedMediaTypes collection and keep getting this error:
System.ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array
The only type that I can see the array taking is of MediaTypeHeaderValue. I cannot for the life of me figure out what is going on. HELP!
My code:
Friend Sub Register(config As HttpConfiguration)
config.MapHttpAttributeRoutes()
config.Formatters.JsonFormatter.SupportedMediaTypes.Add(New MediaTypeHeaderValue("text/html"))
End Sub
The problem was that my projects web.config was referencing version 4.0.0.0 of the system.net.http assembly
<add assembly="System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a/">
I changed it back to the 2.0.0.0 assembly and the function worked as usual
<add assembly="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a/">

ThinkTecture.IdentityModel "The type 'System.IdentityModel.Tokens.SecurityToken' is defined in an assembly that is not referenced

I start using ThinkTecture.IdentityModel in my project and I am facing a serious issue. Please help me on the same.
Error 1 "The type 'System.IdentityModel.Tokens.SecurityToken' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Try manually adding the System.IdentityModel dll reference from the assemblies. This is what worked for me.
-Right click project, add reference
-Assemblies, Framework, System.IdentityModel v4.0.0.0

ASP.3.5 Error while using Enterprise Library

I have a VisualStudio solution created in Vs2005 which is making use of Microsoft Enterprise Data Library.Now I converted this to Visual studio 2008 .Now when i buid the project ,i am getting an error like the below
An error occurred creating the configuration section handler for dataConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) (D:\dotnet\Test\Test.UI\web.config line 4)
My Web.Config 4 th line is as follows
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=3.5.0.0, Culture=neutral, PublicKeyToken=null"/>
I chanegd the version from 2.0.0.0 to 3.5.0.0 .But no result.Same error i am getting.
Can anyone help me to solve this ? Thanks in advance
Have you checked if the public key token is in fact null? You can do this with sn –T Microsoft.Practices.EnterpriseLibrary.Data.dll

Resources