Zendesk .NET API and ASP.NET MVC 3 - asp.net

I am using the Zendesk C# API Wrapper (https://github.com/eneifert/ZenDeskApi) in my ASP.NET MVC 3 Visual Studio 2012 project. I referenced the ZenDeskApi DLL and everything works fine in debug mode locally.
When I try to Publish the website I first get the following error:
Could not load file or assembly '...\Source\Bin\ZenDeskApi.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
Then I tried adding the RestSharp.DLL that comes with the package:
Could not load file or assembly '...\Source\Bin\RestSharp.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
Then I tried adding the Newtonsoft.Json.NET35.DLL that comes with the package:
Could not load file or assembly ...\Source\Bin\Newtonsoft.Json.Net35.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
Is it possible that the problem is the Newtonsoft.Json.NET35.DLL .NET 3.5 version? Incompatible with .NET 4 that MVC needs?
I downloaded the RestSharp source code (https://github.com/restsharp/RestSharp) to try to update the Newtonsoft.Json reference to .NET version 4.0 (available here http://json.codeplex.com/) but with my surprise RestSharp does not reference it.
What should I do to publish my website?
Thanks.
EDIT: in the meantime I discovered the v2 of this api here: https://github.com/eneifert/ZendeskApi_v2 but I always have problems with .NET version of the various DLLS. How can I find all the necessary stuff to work with .NET 4.0?

I solved installing Zendesk API v2 from NuGet (inside Visual Studio 2012) and using the following connection string:
https://company.zendesk.com/api/v2
instead of
http://company.zendesk.com

Related

COULD NOT LOAD TYPE 'System.Security.Principal.WindowsImpersonationContext' from assembly 'mscorlib'

I'm creating an ASP.NET API Core application, to handle API services, which communicate to an Oracle Database.
At runtime, when the process tries to connect to the DB with a new Oracle Connection throught a DbContext ( Entity Framework) an unhandled error appears and forces the app to stop.
myDbContext.Database.Connection.Open();
This line causes the following error
System.TypeLoadException : 'Could not load type
'System.Security.Principal.WindowsImpersonationContext' from assembly
'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxx'.'
I had an old but similar project which used the same code and worked properly.
The library used is the same for Oracle Connector : Oracle.ManagedDataAccess.EntityFramework
What I tried :
Unistall - Reinstall Oracle.ManagedDataAccess.EntityFramework,
same for other Oracle connector ( Oracle.ManagedDataAccess, Oracle.ManagedDataAccess.Core )
Install System.Security.Principal
Changing the target framework from 3.1 to 5
I went first to this page 'System.Security.Principal.WindowsImpersonationContext' from assembly 'mscorlib' error when trying to parse template with Razor Engine but did not find anything that could help me resolve this.
For dot net 6, I was getting the same exception. Only kept the package: Oracle.ManagedDataAccess.Core and removed all others related to oracle and it works.
Get rid of 'Oracle.ManagedDataAccess'. I had both 'Oracle.ManagedDataAccess' and 'Oracle.ManagedDataAccess.Core' installed. This issue is most likely caused because 'Oracle.ManagedDataAccess' is for .NET Framework and not .NET Core/.NET 6.
I had the same problem. The .NET Core version has the same name as the .NET Framework version Oracle.ManagedDataAccess.dll but with a lower version number. As a result, Visual Studio takes the higher version from the GAC rather than the NuGet package. -> Delete the GAC version.

"Built by a runtime newer than the currently loaded runtime" after installing Visual Studio 2019 for ASP.NET 3.5 Web Project

I just got a new PC and after pulling down an existing .NET 3.5 SP1 web project, changing one line of C#, building and deploying I am getting the error below. I was previously using Visual Studio 2017, but am using 2019 on my new PC. I've checked my .NET versions on my projects in VS2019 and they have not changed, nor have the project or solution files. Any idea why there's a difference in the runtime versions when publishing and deploying to the web server?
Could not load file or assembly 'MyApp.Web.XmlSerializers' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
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 'MyApp.Web.XmlSerializers' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
I've sometimes had the same issue and have resulted in re-creating the project and using the existing code files.
I've tried to update packages to the latest version, but this can sometimes be difficult since all the packages reference each other

Getting 'could not load file or assembly' error in .NET Core 2.0

I am getting the below error:
System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.'
What I did:
Created new project in .NET Core 2.0.
Added project reference of class library built out in .Net framework 4.6.1.
Access function from class library which is using System.Data.OracleClient for database connection.
But it's failing while invoking function with above error.
How do we support accessing old .NET libraries built out earlier with lot of internal references in .NET Core project?
Unfortunately, you cannot.
Your project built with .NET Core must have only libraries built for .NET Core. You can't use the one built for .NET Framework.
Here is a quote from the book ASP.NET Core in Action when deciding to develop with .NET Core rather than .NET Framework:
The largest obstacle you’re likely to come across is a third-party
library holding you back, either because they only support older
ASP.NET features, or they haven’t been converted to work with .NET
Core yet.

Error System.NotSupportedException on Razor Pages Project

After researching a lot and finding nothing about it, I decided to ask for collaboration here in the community.
I am trying to perform run in Visual Studio 2019 from a Razor Pages project, created in the 2017 version of Visual Studio. The Target Framework is net461.
However, the following error occurs:
NotSupportedException: Attempting to load an assembly from a network
location that would cause the assembly to be in safe mode in earlier
versions of the .NET Framework. This version of the .NET Framework
does not enable CAS policy by default, so this loading can be
dangerous. If it does not intend to confine the assembly, enable the
loadFromRemoteSources option.
I am not loading any assemblies over the network. All files are on my computer. Also, all exe, dll files are unlocked.
Error is in the startup.cs:
services.AddMvc()
I greatly appreciate any help.
are you creating .NET 4.6.* project or .Net Core? For .Net Core the target framework should be .NET Core 2.* or 3.* and make sure SDK is installed on your machine.

Error While loading project in VS2012

Error 109 'Could not load file or assembly 'DevExpress.Web.v14.1,
Version=14.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a' or
one of its dependencies. Invalid pointer (Exception from HRESULT:
0x80004003 (E_POINTER))'
I use to work on VS2008 previously, but recently I have moved from VS2008 to VS2012. Everything is working good, but whenever I add Devexpress Control(Grid View) in my project, I am getting this error message.
I have searched for this error on Google, and everytime I have found the below mentioned link but it didn't solved my problem.
Link I use to get from Google : https://www.devexpress.com/Support/Center/Question/Details/KA18620
Please help.
I think that your project is targeted to a .NET version prior to 4. Version 14.1 of DevExpress components requires .NET 4+. Change your .NET version in the project properties.

Resources