|
As Stephen said in the blog post, Task.Run is equivalent to:
Task.Factory.StartNew(someAction, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
It is possible to get proper async support in LINQ to SQL, although it's not perfect. For example:
public static async Task<List<T>> ToListAsync(this IQueryable<T> query, DbContext context, CancellationToken cancellationToken = default)
{
if (query is null) throw new ArgumentNullException(nameof(query));
if (context is null) throw new ArgumentNullException(nameof(context));
using (var command = (SqlCommand)context.GetCommand(query))
{
await command.Connection.OpenAsync(cancellationToken);
using (var reader = await command.ExecuteReaderAsync(CommandBehavior.CloseConnection, cancellationToken))
{
return _context.Translate<T>(reader).ToList();
}
}
} DataContext.GetCommand(IQueryable) Method (System.Data.Linq) | Microsoft Docs[^]
DataContext.Translate Method (System.Data.Linq) | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: using (var reader = await command.ExecuteReaderAsync(CommandBehavior.CloseConnection, cancellationToken))
{
return _context.Translate<T>(reader).ToList();
}
OK, so I'm using Linq to SQL. What more can I do to make the method async? The Command has the ExecuteReaderAsync method, but my Linq to SQL code won't have any of that. For example:
public Task<List<ReportData>> GetReportData(ReportArgsEntity args)
{
var t = Task.Run(() =>
{
var results = new List<ReportData>();
using (var dc = GetDataContecxt())
{
results = (from c in dc.Companies
join ih in dc.InvoiceHeaders on c.Id equals ih.CustomerId
join id in dc.InvoiceDetails on ih.Id equals id.HeaderId
where c.Completed
select new ReportData
{
}).ToList();
}
return results;
});
return t;
}
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Use the extension method from my previous post. For example:
public async Task<List<ReportData>> GetReportData(ReportArgsEntity args)
{
await Task.Yield().ConfigureAwait(false);
var query = from c in dc.Companies
join ih in dc.InvoiceHeaders on c.Id equals ih.CustomerId
join id in dc.InvoiceDetails on ih.Id equals id.HeaderId
where c.Completed
select new ReportData
{
};
return await query.ToListAsync(dc);
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I see.
The whole reason I'm asking is that right now all of the code is on the UI thread. But we're going to be moving the BL & DAL to Controllers in an ASP.Net Web API. So the UI will need to fire & forget each call and await the results.
Given that, and other that what we've already discussed, any reason this wouldn't work?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
The Web API action can be async , so this code will just work as-is. You might want to drop the Task.Yield line though, since you're not worried about blocking the UI thread.
The client code can make async requests to the web API - how easy that is will depend on which library you're using to call it. Using async and await will ensure that the UI thread isn't blocked whilst you're waiting for a response from the network.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks Richard
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I am storing jSon string as hexa-decimal or some characters string, its all working fine whan I retrieving as json string in my code, but there is one field I want to remove from the jSob object after I retrieved.
var t = StoredProcedures.SP_GlobalSearch.Execute(new SP_GlobalSearch_Params
{
Search = request.search,
SourceKey = "",
Skip = start,
Take = length,
ShowDeleted = false
}).Select(x => new SP_GlobalSearch
{
JsonObject = x.Data != null ? new JavaScriptSerializer().DeserializeObject(x.Data.Replace("", "")) : null,
Date = x.Date,
JsonObjectId = x.JsonObjectId,
SourceKey = x.SourceKey,
SourceId = x.SourceId,
TotalCount = x.TotalCount
});
var response = t?.ToList();
var jsondata = new DataTableResponse<SP_GlobalSearch>
{
totalCount = (int)response.Where(x => x.TotalCount != null).FirstOrDefault().TotalCount,
data = response.Where(x => x.TotalCount == null)
};
var jsonResult = Json(jsondata);
jsonResult.MaxJsonLength = Int32.MaxValue;
return jsonResult; I am reading the text as jSon with the below statement,
JavaScriptSerializer().DeserializeObject(x.Data.Replace("", ""))
I want to remove the violations field from it, any help please. Thanks in advance
Here is my json:
{
"InspectionResultId":846,
"InspectionResultNumber":"T00846",
"InspectionRequestId":507,
"InspectionRequestNumber":"R00507",
"CaseId":689,
"InspectionResultStatusId":605,
"EnforcementSectionId":104,
"ViolationTypeId":603,
"DateOfInspection":"\/Date(1589439600000)\/",
"InspectionComment":"send to office staff, open investigation",
"InspectedCompanyDataId":964,
"ContactTypeId":701,
"EnteredById":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"InspectionResultTimestamp":"\/Date(1588280817470)\/",
"DateCreated":"\/Date(1588280817487)\/",
"DateUpdated":"\/Date(1588281867967)\/",
"CreatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"UpdatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"Case":{
"RelatedContactId":0,
"CaseId":689,
"CaseNumber":"I00689",
"IsInvestigation":true,
"CaseStatusId":801,
"InspectionItemSourceId":211,
"EnforcementSectionId":104,
"ReminderDate":"\/Date(1590044400000)\/",
"PreCaseSummary":"send to office staff, open investigation",
"AssignedToInspectorId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"CaseTimestamp":"\/Date(1588281867403)\/",
"CaseCompanyId":964,
"DateCreated":"\/Date(1588281867437)\/",
"DateUpdated":"\/Date(1588281867840)\/",
"CreatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"UpdatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"IsDeleted":false,
"InterpreterNeeded":false,
"VoluntaryDisclosure":false,
"PenaltyAdjustment":0,
"Company":{
"ContactId":964,
"ContactTypeId":1000,
"FirstName":"04.30.2020 new co",
"Notes":"new request",
"Active":true,
"Created":"\/Date(1588279909680)\/",
"Updated":"\/Date(1588279909680)\/",
"DateCreated":"\/Date(1588279909680)\/",
"DateUpdated":"\/Date(1588279909680)\/",
"IsEJArea":false,
"CreatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"UpdatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"Classification":{
},
"Class":"Company",
"IsSpecial":false,
"Address":{
"Street1":"5678 Street",
"City":"Sacramento",
"StateCode":"CA",
"Zip":"95812",
"Country":"0"
}
}
},
"InspectionResultStatus":{
"InspectionResultStatusId":605,
"InspectionResultStatusName":"Clean",
"InspectionResultStatusSortOrder":5
},
"EnforcementSection":{
"EnforcementSectionId":104,
"EnforcementSectionName":"STBES",
"EnforcementSectionSortOrder":0,
"BranchId":2
},
"InspectedCompanyData":{
"ContactId":964,
"ContactTypeId":1000,
"FirstName":"04.30.2020 new co",
"Notes":"new request",
"Active":true,
"Created":"\/Date(1588279909680)\/",
"Updated":"\/Date(1588279909680)\/",
"DateCreated":"\/Date(1588279909680)\/",
"DateUpdated":"\/Date(1588279909680)\/",
"IsEJArea":false,
"CreatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"UpdatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"Classification":{
},
"Class":"Company",
"IsSpecial":false
},
"InspectionItems":[
{
"InspectionItemId":1054,
"InspectionItemNumber":"T00000",
"InspectionRequestId":507,
"InspectionResultId":846,
"CaseId":689,
"InspectionItemSourceId":229,
"IsCreatedInCase":false,
"ShowYearMakeModel":"",
"ShowYearMakeModelVIN":"",
"GrossWeight":0.00,
"RegHoldSet":false,
"InspectionItemTimestamp":"\/Date(1588280802553)\/",
"DateCreated":"\/Date(1588280802567)\/",
"DateUpdated":"\/Date(1588281868153)\/",
"CreatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"UpdatedByUserId":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"Violations":[
]
}
],
"CompletedBy":[
{
"IsActive":true,
"FirstName":"Daphne",
"LastName":"Greene",
"ObjectGUID":"S-1-5-21-1538631513-416410304-3002070310-33442",
"NameLoginFormat":"dgreene",
"NameFirstLast":"Daphne Greene",
"NameLastFirst":"Greene Daphne",
"Email":"daphne.greene@arb.ca.gov",
"EmailConfirmed":false,
"SecurityStamp":"e061e77e-c93e-4b9e-8497-4852b5cb4ca2",
"PhoneNumberConfirmed":false,
"TwoFactorEnabled":false,
"LockoutEnabled":false,
"AccessFailedCount":0,
"Id":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"UserName":"dgreene"
}
],
"EnteredBy":{
"IsActive":true,
"FirstName":"Daphne",
"LastName":"Greene",
"ObjectGUID":"S-1-5-21-1538631513-416410304-3002070310-33442",
"NameLoginFormat":"dgreene",
"NameFirstLast":"Daphne Greene",
"NameLastFirst":"Greene Daphne",
"Email":"daphne.greene@arb.ca.gov",
"EmailConfirmed":false,
"SecurityStamp":"e061e77e-c93e-4b9e-8497-4852b5cb4ca2",
"PhoneNumberConfirmed":false,
"TwoFactorEnabled":false,
"LockoutEnabled":false,
"AccessFailedCount":0,
"Id":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"UserName":"dgreene"
},
"MyGridContacts":[
],
"CreatedByUser":{
"IsActive":true,
"FirstName":"Daphne",
"LastName":"Greene",
"ObjectGUID":"S-1-5-21-1538631513-416410304-3002070310-33442",
"NameLoginFormat":"dgreene",
"NameFirstLast":"Daphne Greene",
"NameLastFirst":"Greene Daphne",
"Email":"daphne.greene@arb.ca.gov",
"EmailConfirmed":false,
"SecurityStamp":"e061e77e-c93e-4b9e-8497-4852b5cb4ca2",
"PhoneNumberConfirmed":false,
"TwoFactorEnabled":false,
"LockoutEnabled":false,
"AccessFailedCount":0,
"Id":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"UserName":"dgreene"
},
"UpdatedByUser":{
"IsActive":true,
"FirstName":"Daphne",
"LastName":"Greene",
"ObjectGUID":"S-1-5-21-1538631513-416410304-3002070310-33442",
"NameLoginFormat":"dgreene",
"NameFirstLast":"Daphne Greene",
"NameLastFirst":"Greene Daphne",
"Email":"daphne.greene@arb.ca.gov",
"EmailConfirmed":false,
"SecurityStamp":"e061e77e-c93e-4b9e-8497-4852b5cb4ca2",
"PhoneNumberConfirmed":false,
"TwoFactorEnabled":false,
"LockoutEnabled":false,
"AccessFailedCount":0,
"Id":"7f54fa3e-b5cd-4b2e-9490-92f64c022246",
"UserName":"dgreene"
}
}
I want to remove the Violations part from the jSon object, can you please help me in this regards thank you.
modified 11-Jun-20 18:08pm.
|
|
|
|
|
You can't "remove" the violations from the JSON once you have read it: either it's still in the JSON string (in which case you probably want to look at a Regex or similar to remove fit from that) or it's a part of the InspectionItem class and the best you can do is set the InspectionItem.Violations property to null for each instance in your data.
You can't "delete" a property from a class after compilation!
Probably the best way would be to use a Regex to remove the Violations section from the JSON source before you deserialize it - but there could be some significant work involved in writing that, given that the sample you show does not contain any data in the Violations section, so we have no idea how complicated that JSON clause might be when filled in. Complicated clause == complicated Regex!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Yeah making that property value null is fine - can you please help me in this regards please? Or can you please help me with the Regex please? Thank you.
|
|
|
|
|
You don't know how to set a property?
Why are you playing with JSON if you don't know the (very, very) basics?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
To answer this we need to know the type of SP_GlobalSearch.JsonObject . If it's something like a InspectionResult class or even a dynamic , then it's simple:
var response = t==null? null : t.Select(r=>{r.InspectionItems.Violations = null; return r;}).ToList();
If JsonObject is a System.Object, then things get messy. Best to change than to one of the options given above.
Truth,
James
|
|
|
|
|
I have been away from Windows desktop development environment (Using C++ MFC) for many years.
Recently, I plan to port an Android app to Windows desktop environment.
I plan to use C# as my tech stack.
However, I have 0 clue on how to develop a
- Card liked UI dashboard
- Achieve drag-n-move animation
Our Android app looks like - Drag and move animation - YouTube[^]
Do you have any suggestion library, which can help me to implement so?
Thank you.
|
|
|
|
|
|
In the video, it shows how "Card liked UI dashboard" look like.
Also, this is a JavaScript implementation of "Card liked UI dashboard" - Column grid demo[^]
As you can see, the JavaScript example supports drag-n-move, and resizing.
Any idea on where I can get an equivalent C# desktop library to implement such?
Thanks.
|
|
|
|
|
yccheok wrote: where I can get an equivalent C# desktop library to implement such? If you want a ready made lbrary then Google is the place to search. Or you could just write your own code to move things around on a form.
|
|
|
|
|
Hello Everyone,
I'm currently trying to fetch data from 1 excel workbook, which is having multiple sheets
Please find my excel sheet: here
Please find my code to get the excel data
<pre>public static T GetAllTestData<T>(string keyName)
{
using (var connection = new
OdbcConnection(TestDataFileConnection()))
{
connection.Open();
System.Data.DataTable dt = null;
dt = connection.GetSchema(OdbcMetaDataCollectionNames.Tables, null);
String[] excelSheets = new String[dt.Rows.Count];
var i = 0;
foreach (DataRow row in dt.Rows)
{
excelSheets[i] = row["TABLE_NAME"].ToString();
i++;
}
T value = default(T);
for (int j = 0; j < excelSheets.Length; j++)
{
var query = string.Format("select * from [{0}] where TestName = '{1}'", excelSheets[j], keyName);
value = connection.Query<T>(query).FirstOrDefault();
}
connection.Close();
return value;
}
}
Call to the function:
var param1 = AccessExcelData.GetAllTestData<TestDataModel>("Test1");
Issue:
I want to get all the values from all the sheets in excel which has TestName as "Test1" but in my method, variable value keep getting override which makes it tough for me to get all the values
Can someone look into this, or If I can have another approach for handling excel data test in c#
|
|
|
|
|
Your problem is in the following loop ...
for (int j = 0; j < excelSheets.Length; j++)
{
var query = string.Format("select * from [{0}] where TestName = '{1}'", excelSheets[j], keyName);
value = connection.Query<T>(query).FirstOrDefault();
} As soon as you have got a value in the value field, you move on to the next sheet. You need to either do something with the value before going round the next iteration of the loop or store the values (one per sheet) e.g. in an array, and then process them all together after completing the loop.
|
|
|
|
|
Not all code within the called method "displayTimeEvent" runs every 2 seconds.
var awaitExit = new System.Timers.Timer();
awaitExit.Interval = 2000;
awaitExit.Elapsed += displayTimeEvent;
awaitExit.Start();
void displayTimeEvent(object source, ElapsedEventArgs e)
{
int s = DateTime.Now.Second;
displayMessage("Second: " + s.ToString());
label1.Text += ".";
progressBar1.Increment(20);
}
|
|
|
|
|
|
Hi,
use a System.Windows.Forms.Timer or read up on cross-thread issues e.g. here[^]
|
|
|
|
|
753/5000
Hello,
I wanted to recover data from an oracle 9i database. I work on 64 bit systems.
I downloaded the driver ODAC112040Xcopy_64bit in which I found .dlls (among which there is Oracle.DataAccess.dll) that I added them to a windows console application under visual studio 2012 and I added Oracle. DataAccess.dll as a reference in the application. So it works for recovery.
Now, I wanted to create a web service to do this recovery.
So, I created a project of type "ASP.NET Empty Web Application" for I added an element of type web service just that displays by default "Hello Wrold". When I compile and run the application then I get the following message:
Bonjour,
Je voulais récupérer des données à partir d'une base des données oracle 9i. Je travail sur des systèmes de 64 bit.
J'ai téléchargé le driver ODAC112040Xcopy_64bit dans lequel j'ai trouvé des .dll (parmi lequel il y a Oracle.DataAccess.dll) que j'ai les ajouté à une application windows console sous visual studio 2012 et j'ai ajouté Oracle.DataAccess.dll comme référence dans l'application. Alors ça marche pour la récupération.
Maintenant, je voulais créer un web service pour faire cette récupération.
Alors, j'ai crée un projet de type "ASP.NET Empty Web Application" pour j'ai ajouté un élément de type web service juste que affiche par défaut "Hello Wrold". Lorsque je compile et j’exécute l'application alors j'ai le message suivant :
Server error in application '/'.
Unable to load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load an incorrect format program.
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.BadImageFormatException: Unable to load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load an incorrect format program.
Source error:
An unhandled exception occurred while running the current web request. Information about the origin and location of the exception can be identified using the exception stack trace below.
Assembly load tracking: The following information can help determine why the assembly 'Oracle.DataAccess' could not be loaded.
=== Prior link status information ===
JRN: DisplayName = Oracle.DataAccess
(Partial)
AVT: partial link information has been provided for an assembly:
AVT: Assembly name: Oracle.DataAccess | Domain ID: 2
AVT: Partial binding occurs when only part of the full assembly name is provided.
AVT: This can cause the workbook to load an incorrect assembly.
AVT: it is recommended to provide a fully specified text identity for the assembly,
AVT: which includes the simple name, version, culture and public key token.
AVT: For more information and solutions to this problem, see the white paper at http://go.microsoft.com/fwlink/?LinkId=109270.
JRN: Appbase = file: /// D: / Development / Projects / WebApplicationWS / WebApplicationWS /
JRN: Initial PrivatePath = D: \ Development \ Projects \ WebApplicationWS \ WebApplicationWS \ bin
Assembly calling: (Unknown).
===
JRN: this link starts in the context of loading default.
JRN: use of the application configuration file: D: \ Development \ Projects \ WebApplicationWS \ WebApplicationWS \ web.config
JRN: use of the host configuration file:
JRN: use of the computer configuration file from C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ config \ machine.config.
JRN: strategy not applied to the reference at this stage (private, custom, partial or location-based assembly binding).
JRN: attempt to download the new URL file: /// C: /Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files / vs / b3838e6a / facd81ed / Oracle.DataAccess.DLL.
JRN: attempt to download the new URL file: /// C: /Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files / vs / b3838e6a / facd81ed / Oracle.DataAccess / Oracle.DataAccess.DLL .
JRN: attempt to download the new URL file: /// D: /Developpement/Projets/WebApplicationWS/WebApplicationWS/bin/Oracle.DataAccess.DLL.
ERR: unable to complete the installation of the assembly (hr = 0x8007000b). Detection completed.
Battery trace:
[BadImageFormatException: Unable to load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load an incorrect format program.]
System.Reflection.RuntimeAssembly._nLoad (AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark & stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurity0
System.Reflection.RuntimeAssembly.nLoad (AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark & stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Booleansressressecurity)
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName (AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark & stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection + BooleanSuppress15
System.Reflection.RuntimeAssembly.InternalLoad (String assemblyString, Evidence assemblySecurity, StackCrawlMark & stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +80
System.Reflection.RuntimeAssembly.InternalLoad (String assemblyString, Evidence assemblySecurity, StackCrawlMark & stackMark, Boolean forIntrospection) +22
System.Reflection.Assembly.Load (String assemblyString) +29
System.Web.Configuration.CompilationSection.LoadAssemblyHelper (String assemblyName, Boolean starDirective) +39
[ConfigurationErrorsException: Unable to load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load an incorrect format program.]
System.Web.Configuration.CompilationSection.LoadAssembly
Erreur du serveur dans l'application '/'.
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.
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.BadImageFormatException: 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.
Erreur source:
Une exception non gérée s'est produite lors de l'exécution de la requête Web actuelle. Les informations relatives à l'origine et l'emplacement de l'exception peuvent être identifiées en utilisant la trace de la pile d'exception ci-dessous.
Suivi du chargement de l'assembly: Les informations suivantes peuvent permettre de déterminer la raison pour laquelle l'assembly 'Oracle.DataAccess' n'a pas pu être chargé.
=== Informations d'état de liaison préalable ===
JRN : DisplayName = Oracle.DataAccess
(Partial)
AVT : des informations de liaison partielle ont été fournies pour un assembly :
AVT : Nom d'assembly : Oracle.DataAccess | ID de domaine : 2
AVT : une liaison partielle se produit lorsqu'une partie seulement du nom complet de l'assembly est fournie.
AVT : cela peut entraîner le chargement d'un assembly erroné par le classeur.
AVT : il est recommandé de fournir une identité textuelle complètement spécifiée pour l'assembly,
AVT : qui comprend le nom simple, la version, la culture et le jeton de clé publique.
AVT : pour plus d'informations et pour obtenir des solutions à ce problème, consultez le livre blanc à l'adresse suivante http://go.microsoft.com/fwlink/?LinkId=109270.
JRN : Appbase = file:///D:/Developpement/Projets/WebApplicationWS/WebApplicationWS/
JRN : PrivatePath initial = D:\Developpement\Projets\WebApplicationWS\WebApplicationWS\bin
Assembly appelant : (Unknown).
===
JRN : cette liaison démarre dans le contexte de chargement de default.
JRN : utilisation du fichier de configuration de l'application : D:\Developpement\Projets\WebApplicationWS\WebApplicationWS\web.config
JRN : utilisation du fichier de configuration d'hôte :
JRN : utilisation du fichier de configuration de l'ordinateur à partir de C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
JRN : stratégie non appliquée à la référence à ce stade (liaison d'assembly privée, personnalisée, partielle ou basée sur l'emplacement).
JRN : tentative de téléchargement de la nouvelle URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/b3838e6a/facd81ed/Oracle.DataAccess.DLL.
JRN : tentative de téléchargement de la nouvelle URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/b3838e6a/facd81ed/Oracle.DataAccess/Oracle.DataAccess.DLL.
JRN : tentative de téléchargement de la nouvelle URL file:///D:/Developpement/Projets/WebApplicationWS/WebApplicationWS/bin/Oracle.DataAccess.DLL.
ERR : impossible de terminer l'installation de l'assembly (hr = 0x8007000b). Détection terminée.
Trace de la pile:
[BadImageFormatException: 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.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +37
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +159
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +80
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +22
System.Reflection.Assembly.Load(String assemblyString) +29
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +39
[ConfigurationErrorsException: 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.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +777
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +229
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +140
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +176
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +99
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +310
System.Web.Compilation.BuildManager.ExecutePreAppStart() +165
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +590
[HttpException (0x80004005): 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.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10082160
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +99
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +464
Informations sur la version : Version Microsoft .NET Framework :4.0.30319; Version ASP.NET :4.8.4110.0
|
|
|
|
|
This is an English language site, and we can only answer questions posted in that language. Please use Google Translate to convert your message before posting in future.
But the error message is pretty clear:
Unable to load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load an incorrect format program.
At a guess, the Oracle DB engine is missing (or at least partially missing), configured for 32 bit when the system is 64, or vice versa, etc. Eitehr way, this isn;t somethign we can really help you with.
Start by contacting your hosting service and ask them if they have had this problem before - they may be able to shortcut the process of working out exactly what you have done.
Il s'agit d'un site en anglais et nous ne pouvons répondre qu'aux questions publiées dans cette langue. Veuillez utiliser Google Translate pour convertir votre message avant de poster à l'avenir.
Mais le message d'erreur est assez clair:
Impossible de charger le fichier ou l'assembly 'Oracle.DataAccess' ou l'une de ses dépendances. Une tentative de chargement d'un programme au format incorrect a été effectuée.
À une supposition, le moteur Oracle DB est manquant (ou au moins partiellement manquant), configuré pour 32 bits lorsque le système est à 64, ou vice versa, etc. De toute façon, ce n'est pas le cas, nous pouvons vraiment vous aider.
Commencez par contacter votre service d'hébergement et demandez-leur s'ils ont déjà rencontré ce problème - ils pourront peut-être raccourcir le processus d'élaboration de ce que vous avez fait.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
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.
|
|
|
|
|