|
When you get a BadImageFormat exception, it usually means you're trying to mix 32 and 64-bit code in the same process.
From your description, you are probably trying to use a 64-bit .DLL in a 32-bit app, or your code is running as 32-bit instead of 64.
|
|
|
|
|
|
Considering you never said what change you made and what the IIS app and app pool settings currently are, there's nothing anyone can tell you.
|
|
|
|
|
Bonjour,
le driver Oracle Data Access de version 64 bits
Lorsque je crée un application console çà marche pour le driver.
Lorsque je crée une application web asp.net alors le driver ne fonctionne. Les propriétés de cette application :
- target framework 4.0
- Platform target : any CPU
J'ai changé "any cpu" par "X86" mais le même problème puis avec "X64" aussi le même problème
- le web : J'ai coché l'option "use Visual Studio Development Server"
au lieu de "use Local IIS Web Serve"
|
|
|
|
|
Translated:
Quote: Hello
Oracle Data Access driver of 64-bit version
When I create a console app it works for the driver.
When I create a web application asp.net then the driver does work. The properties of this application:
- target framework 4.0
- Platform target: any CPU
I changed 'any cpu' to 'X86' but the same problem then with 'X64' also the same problem
- the web: I checked the option "use Visual Studio Development Server"
instead of "use Local IIS Web Serve"
A console app is not an ASP.NET app. They work in completely different ways.
A platform target of "AnyCPU" runs, by default either as the CPU architecture on older versions of .NET or as a 32-bit app.
Changing the platform target to "X86" forces the app to run as 32-bit only, even on a 64-bit machine.
Change the target to x64 to match the architecture of the .DLL's you're using. In IIS, in the Application Pool you are running your code under, under Advanced Options, there is an option to run the app as a 32-bit app instead of 64-bit. If that setting is turned on, your code will run as 32-bit instead of 64-bit.
Also, you MUST install the Oracle Client on the IIS server in order for Oracle database access to work.
modified 11-Jun-20 12:16pm.
|
|
|
|
|
Je vous informe que dans les paramètres avancés de pool application que l'option " activer les applications 32 bits" est déja comme valeur "false"
j'ai changé "Platform target" à X86
mais le même message d'erreur.
Impossible de charger le fichier ou l'assembly 'Oracle.DataAccess' ou une de ses dépendances. Tentative de chargement d’un programme de format incorrect.
|
|
|
|
|
Translated:
Quote: I inform you that in the advanced application pool settings that the option "activate 32-bit apps" is already as "false"
I changed "Platform target" to X86
but the same error message.
Can't load the 'Oracle.DataAccess' file or assembly or any of its dependencies. Attempting to load an incorrectly format program.
Uhhh... I just got done telling you that x86 means "32-bit" and running 32-bit code in the App Pool is turned OFF. Change the platform target back to x64.
Now, if you're deploying just a single Oracle .DLL with your app, you're definitely doing it wrong. Oracle requires and entire Client installation in order to work. Just deploying one of two .DLL's with Oracle in the name will NOT WORK.
modified 11-Jun-20 12:17pm.
|
|
|
|
|
Bonjour,
J'ai téléchargé le dossier .zip ODAC112040Xcopy_32bit et ODAC112040Xcopy_64bit
Est ce que je dois utiliser ODAC 32bit ou bien ODAC 64bit ?
Ce dossier contient plusieurs types de dll
alors quel(s) .dll à ajouter dans mon projet ?
|
|
|
|
|
Translated:
Quote: Hello
I downloaded the .zip folder ODAC112040Xcopy_32bit and ODAC112040Xcopy_64bit
Do I have to use ODAC 32bit or ODAC 64bit?
This folder contains several types of dll
so what .dll to add to my project?
You're doing this all wrong. You don't just add a .DLL to your project. Oracle does not work that way. Forget what you downloaded.
You have to install the Oracle Client and add ODP.NET to your project through the Nuget Package Manager under the Tools menu in Visual Studio. In NPM, search for "ODP.NET4" and add that to your project.
When deploying your application to a server, that server must also have the Oracle Client installed else your application will not work.
|
|
|
|
|
Actually, the XCopy installation of Oracle client should work if you add all the files to the bin folder.
But only if you don't have another installation with another bitness.
|
|
|
|
|
Bonjour,
J'ai téléchargé "ODAC112040Xcopy_32bit" et j'ai copié les .dll necessaires dans mon projet et j'ai ajouté le driver "Oracle.DataAccess.dll" dans la partie reference de mon projet. J'ai target platform avec 32 bit.
Après compilation et exécution, alors le driver a été bien chargé mais je ne peux pas connecter au base oracle sachant que de version 9i et lire le contenu d'une table.
J'ai le message suivant :
System.TypeInitializationException: Une exception a été levée par l'initialiseur de type pour 'Oracle.DataAccess.Client.OracleConnection'. ---> Oracle.DataAccess.Client.OracleException: The provider is not compatible with the version of Oracle client
à Oracle.DataAccess.Client.OracleInit.Initialize()
à Oracle.DataAccess.Client.OracleConnection..cctor()
--- Fin de la trace de la pile d'exception interne ---
à Oracle.DataAccess.Client.OracleConnection..ctor(String connectionString)
à WebServiceToBD.Service1.view_data() dans d:\Developpement\SiteVs2012\WebServiceToBD\Service1.asmx.cs:ligne 48
Voici le code de méthode :
public DataTable view_data()
{
OracleConnection conn = new OracleConnection("Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = *.*.*.*)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = ***)));User ID=***;Password=***");
conn.Open();
OracleDataAdapter dr = new OracleDataAdapter("select * from Personne", conn);
DataSet ds = new DataSet();
ds.Tables.Add("Personne");
dr.Fill(ds,"Personne");
DataTable tt = ds.Tables[0];
return tt;
}
<pre lang="c#">
La ligne 48 correspond au code suivant :
<pre lang="c#">OracleConnection conn = new OracleConnection("Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = *.*.*.*)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = ***)));User ID=***;Password=***");
Cette chaîne de connexion existe dans le programme et pas dans le fichier "Web.config".
modified 12-Jun-20 3:54am.
|
|
|
|
|
When you are using unmanaged code (the Oracle Client in this case), EVERYTHING need to have the same bitness (32 or 64 bits), including the client, debugger, IIS Application pool and the VSHost.exe.
More info on that here: Visual Studio Debugging and 64 Bit .NET Applications - Rick Strahl's Web Log[^]
In this case I'm not even sure if you have the same bitness on the Oracle.DataAccess.dll and the rest of the client files.
You can use corflags.exe to determine bitness of an .exe
|
|
|
|
|
Thanks it works for the driver.
I used this driver in a .net web service. Then I will call this web service in another asp net project. The web service call and the data recovery work on a table with a reduced number of lines.
Now, I wanted to retrieve the contents of a table that contains 1844 rows and 58 columns.
After compilation and execution, I have the following message:
Server error in application '/'.
The maximum size quota allowed for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.
Description: An unhandled exception occurred during the execution of the current web request. Check the stack trace for more information on the error and its origin in the code.
Exception details: System.ServiceModel.QuotaExceededException: The maximum size quota allowed for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.
modified 12-Jun-20 9:17am.
|
|
|
|
|
|
Erreur du serveur dans l'application '/'.
Le quota de taille maximale autorisée pour les messages entrants (65536) a été dépassé. Pour augmenter le quota, utilisez la propriété MaxReceivedMessageSize sur l'élément de la liaison appropriée.
Description : Une exception non gérée s'est produite au moment de l'exécution de la requête Web actuelle. Contrôlez la trace de la pile pour plus d'informations sur l'erreur et son origine dans le code.
Détails de l'exception: System.ServiceModel.QuotaExceededException: Le quota de taille maximale autorisée pour les messages entrants (65536) a été dépassé. Pour augmenter le quota, utilisez la propriété MaxReceivedMessageSize sur l'élément de la liaison appropriée.
|
|
|
|
|
Random random = new Random();
int character = 15;
int mobhp = 3;
Console.WriteLine("You are an adventuurer.");
Console.WriteLine("you are walking across the forest when suddenly you encounter a");
string [] monster = {"imp", "goblin", "hobgoblin",};
string monsters = (monster[(random.Next(0, 3))]);
Console.WriteLine(monsters);
switch (monsters){
case "goblin":
mobhp = 11;
break;
case "imp":
mobhp = 8;
break;
case "hobgoblin":
mobhp = 15;
break;
}
string entry = Console.ReadLine();
string hit = "attack";
string regenerate = "heal";
string escape = "run";
switch (entry){
case "hit":
mobhp = mobhp - 4;
Console.WriteLine("You attacked it!");
break;
case "regenerate":
character = character + 2;
Console.WriteLine("you heald 2 hp");
break;
case "escape":
Console.WriteLine("you cant run away!");
break;
|
|
|
|
|
Have you tried putting your questions and answers in a loop that terminates when mobhp is <= 0?
|
|
|
|
|
Hi every body
I've question about thread.
My project get data from IO (use control InstantDiCtrl of Advanetect)
Code: InstantDiCtrl.ReadPort(0, ref data)
When I code on timer function data can get.
but when I code on thread can not get data (always output 0)
What diffrent about thread and timers.
Thank you
|
|
|
|
|
You can't compare threads and timers: that's like comparing electricity to an orange.
A thread is a separately executing "chunk" of code with its own stack which operates independently within a process but which shares common memory with other threads in the process.
A timer is a (fairly) regular event which happens within a thread at an interval.
You need to look at your code - both thread and timer - to work out why your threaded version doesn't work. We can't do that as we have no access to your code other than exactly what you show us - and your code fragment is useless out of context. Do remember that threads cannot access any Controls directly: trying will get you a cross threading exception. Timers don;t have this problem as they run within the thread that created the Timer object.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You can't access/use controls/variables from different threads. Your normal application is the main-thread, and within it, you can access all that you create there. The timer interrupts execution of that mainthread to execute the timed code with that thread.
If you create a new thread, then this will run seperately from the mainthread, without interrupting it. That's the preferred way, but you'd need to read up on how to synchronize your data with the mainthread.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hello, I'm currently making a program that will take a HEX string and convert it into an image.
I talked to a experienced coder and he gave me some steps to my problem:
1) Create a simple hello world program with a main method
2) Make it so your program can print out the byte array you input to the console
3) Figure out how to link in the libraries the code you posted references (looks like SkiaSharp and PakReader)
4) Make the call to the code you showed (TextureDecoder.DecodeImage)
5) Write the resulting SKImage to a file
I'm trying to call a method from a separate program. I'm really inexperienced and confused even after looking at documentation and multiple YT videos.
I had a couple of questions about how I should do this:
I'm trying to call
TextureDecoder.DecodeImage
from the program in the link below.
hastebin[^]
MY current code so far, based off of the first 3 Steps a guy gave me for help:
using System;
using System.IO;
using PakReader.Parsers.Objects;
using SkiaSharp;
namespace EncyptedViewing
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("HEX Input");
}
}
}
I would like to know how I would call the class from the link above TextureDecoder.DecodeImage into the program above, or is that not possible and I need to do it all in one program?
Thanks, and stay safe.
|
|
|
|
|
Try
SKImage ski = PakReader.TextureDecoder.DecodeImage(sequence, width, height, depth, format); You'll have to work out what the parameter values contain for yourself: we have no idea what you are trying to do with it.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I entered code from a YouTube video into Microsofts version 8 compiler but can't get the cards to display. The code is written in 2017 for an older compiler.
In the code it has
Public override string ToString()
{
Return face + " of " + suit;
}
Would this code apply to the latest microsoft compiler?
The only code for printing the cards is
Console.write( deck1.DealCard());
Which is looped.
The problem is finding out why the cards are not displayed.
If needed I could give you the whole code but I can't remember how you format the code in this forum.
Cards should be printed as 4 of hearts etc.
Brian
|
|
|
|
|
The code applies to any version of C#. There's really nothing to it. All it's doing is returning a string with the value of face and suit converted to strings.
Those two variables have to be supplied by other code in your class.
There's no way to tell you what you're doing wrong since we can't see the code for the type deck1 is, nor can we see the code for what, I assume, your card class is.
You're going to have to hit the "Improve question" button to add the relevant code to your question.
Also, stay away from YouTube videos for learning to code. I haven't seen a good one yet.
|
|
|
|
|
Dave Kreskowiak wrote: stay away from YouTube videos for learning to code. I haven't seen a good one yet.
I suspect that most of 'em are created by people who
1) Have no idea how to make a good video
And
2) Have no idea how to code.
They have code that works, but they have no idea why it does - so they blindly type it in and then show "working" results - that most times are unrelated to the code they actually typed.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|