|
hi
i try to connect to Oracle 11.2.0 64bit from my C# program
and i get this error:
Attempt to load Oracle client libraries threw BadImagFormatException.
This problem will occur when running in 64 bit mode with the 32 bit
Oracle client components installed.
what i need to download or change in my C# program ?
thanks in advance
|
|
|
|
|
|
As far as I know, you can't mix 32-bit and 64-bit components in one process. If your process is running in 64-bit mode, you need 64-bit libraries. If you want to use 32-bit libraries, run your process in 32-bit mode.
|
|
|
|
|
I have windows service project created with .NET 3.5 some time ago. It uses managed class library with native code via PInvoke. Recently 4.0 .NET version of that class library was created. I had to change windows service configurstion to 4.0 .NET client also.
Wierd problem started to appear after 4.0 version compilation. After about 1 minute of run service is terminated. In the Windows Events Application Error entry is created (event code 1000, task category (100)):
Application name: MyService.exe, version: 1.0.0.0, timestamp: 0x4d87107f
Module name: clr.dll, version: 4.0.30319.1, timestamp 0x4ba1d9ef
Exception code: 0xc00000fd
Error offset: 0x000ccd3c
Process id: 0x1680
Time: 0x01cbe7b1aaafc5a0
Application path: C:\projects\MyService\release\MyService.exe
Module path C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Report code: 024b8ca0-53a5-11e0-9963-544249093872
With 2 more entries in the events with information from Windows Error Reporting:
Contaier error , type 0
Event name: APPCRASH
Reply: No data
CAB Identifier: 0
Problem signature:
P1: MyService.exe
P2: 1.0.0.0
P3: 4d87107f
P4: clr.dll
P5: 4.0.30319.1
P6: 4ba1d9ef
P7: c00000fd
P8: 000ccd3c
P9:
P10:
With crash dump files reported to be found in C:\ProgramData\Microsoft\Windows\WER\ReportQueue\AppCrash_MyServ_c7f32a85ba9f45a9b76ff6beb5fac592fa5396f3_cab_047b1b2c
There is no specific point in the service it stops to work as I looked in the service logs dumped to text file. Any function call that follows after about 1 minute of work results in the termination. Service has a timer that fires with specific delays which invokes its functionality.
If I comment out managed class library call that uses native code the service termination stops. If I run the same class library with the same service functionality in original 4.0 console project there are no problems either.
Is there any 3.5 to 4.0 migration issues or bugs in 4.0 clr related to native code call in windows service applications?
Чесноков
|
|
|
|
|
I believe there are support cases opened against MS on this, and similar, issues. It may possibly have been fixed in the SP that was rolled out recently, but I cannot say for certain that it has.
|
|
|
|
|
Do you mean that is 3.5 to 4.0 conversion problem or generic problem for the windows service with 4.0 version?
Чесноков
|
|
|
|
|
It's a problem with the 4.0 version as far as I can tell (nothing to do with the conversion). A search of the web found a large number of variations on your problem here - not always a windows service, a long running windows forms app has the same problem.
|
|
|
|
|
Are they going to resolve the problem or are there any updates to 4.0 version or hot fixes?
I found just a couple of such reports having program crash once in a week e.g.
But here exactly after 1 minute it crashes. That is something to be a pattern
Чесноков
|
|
|
|
|
There are hot-fixes rolled up here[^], but there may be problems if you are using C++, so it's worth evaluating in a VM before you install it properly.
Details of what's in the compound fix can be found here[^].
|
|
|
|
|
In any case they are related to 4.0 only?
I've created 4.0 projects from scratch and migrated source code to them.
First service run was very promissing about 5 minutes without problems.
I stopped it and decided the reason was due to migation.
But the next service runs started to behave pretty wierd giving APPCRASH for mscoreei.dll 0xc0000005, and finally the same clr.dll 0xc00000fd without that 1 minute pattern as in 3.5->4.0 version.
Чесноков
|
|
|
|
|
That's correct. The issue seems to have been introduced with the V4 clr.dll.
|
|
|
|
|
I started to experiment with timer interval of the service processing functionality setting it to different values 30,10,15,1,0.5,0.1 seconds. At every timer event service performs some work in worker threads.
First there are the same clr.dll crashes with large timer intervals after exactly 10 calls to unmanaged class library. Then after I tried smaller ones the crashes disappeared. Occasionally there were few new ones:
Framework Version: v4.0.30319
Description: The process was terminated due to an internal error in the .NET Runtime at IP 6B50927D (6B290000) with exit code 80131506.
From the .NET runtime source. But now everything seems to work without problems. I wonder the reason of that erratic behaviour, every day new type of crash.
Have you tried http://support.microsoft.com/kb/2520479[^] yourself? Were there any problems with SP1 for VS Ultimate version with standalone SDK 7.1 installed?
Чесноков
|
|
|
|
|
Hi All,
I am back for eating everybodies head.
Attached is the excel file in which there are 3 formats of a same table in a report.
So based upon these 3 formats I have created 3 different rpt files.
Now the client is saying that he can anytime add any number of columns in any place and report should be generated. This means right now if you have look at the excel file, Format 2 has the highest number of column. But he can introduce fields in between or in the beginning or in the end.
Right now "Reading Before Adjustment" or "Reading After Adjustment" has 3 columns, but number of columns can either increase or decrease also.
So is it possible to dynamically create text object, assign them locations on the report and so on?
I did not find the facility of attachment. You can see the attachment here : Here[^]
Thanks and Regards,
|
|
|
|
|
you can read excel sheet in c#
from first cell to end cell...
and you will be insert into generic list from your data.
then you can sorting and searching...
show under code...
it's connect excel ole connect
-----------------
DataTable dtTempTable = new DataTable();
DataTable dtMyTable = new DataTable();
DataRow drMyRow;
int nRowCount = 0;
nRowCount = 0;
strSCell[0] = "A";
strSCell[1] = "1";
strECell[0] = "IV";
strECell[1] = "65536";
if (CommonLib.IsNullString(FileName.Substring(FileName.Length - 4, 4)).Equals("xlsx"))
{
strProvider = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=";
strProvider += (FilePath + FileName);
strProvider += @";Extended Properties=""Excel 12.0;Imex=1;HDR=YES;""";
strQuery = "Select * From [Sheet1$" + strSCell[0] + strSCell[1] + ":" + strECell[0] + strECell[1] + "]";
}
else
{
strProvider = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
strProvider += (FilePath + FileName);
strProvider += @";Extended Properties=""Excel 8.0;Imex=1;HDR=YES;""";
strQuery = "Select * From [Sheet1$" + strSCell[0] + strSCell[1] + ":" + strECell[0] + strECell[1] + "]";
}
OLEDBConnection = new OleDbConnection(strProvider);
OLECommandObject = new OleDbCommand(strQuery, OLEDBConnection);
OLEDBConnection.Open();
if (OLEReader != null)
{
if (!OLEReader.IsClosed)
OLEReader.Close();
}
OLEReader = OLECommandObject.ExecuteReader(CommandBehavior.CloseConnection);
dtTempTable.Load(OLEReader);
if (dtTempTable.Rows.Count > 0)
{
dtMyTable = dtTempTable.Copy();
}
if (OLEReader != null)
{
if (!OLEReader.IsClosed)
OLEReader.Close();
OLEReader.Dispose();
}
if (OLEDBConnection != null)
OLEDBConnection.Close();
return dtMyTable;
modified on Monday, March 21, 2011 7:01 PM
|
|
|
|
|
Please use the code block button to insert <pre></pre> tags around your code to make it readable. Check the posting guidelines at the top of this forum.
I must get a clever new signature for 2011.
|
|
|
|
|
Modify my reply.
thanks for your kind.
|
|
|
|
|
No problem, I'm glad you have joined the list of people who contribute to the site.
Have fun
I must get a clever new signature for 2011.
|
|
|
|
|
Hey there! Been a while… took a little break from bugging you all with questions .
Anyways I was working on a server/client project so I could just become familiar with socket programming before I took a little "programming" break. Now that I'm going to continue it I had a few questions about trying what I'm attempting to do.
What I want is to create a Agent-Based monitoring application. So the idea would be to have the server sitting out on the WAN listening for connections from the agents. The agents will upload data and will perform more actions in the future.
So what is the best way to handle multiple connections? The connections could range anywhere from 1 to 750 agents that checkin every 30 seconds. Some products that come in mind is Labtech, Kaseya, and Zenith. I was using async sockets and see tons of people out there just creating new threads on a new connection, but surely this will kill the server when you get many connections.
Should I be using a thread pool (haven't dove into how to do this yet), creating new threads, async sockets, or what?
Thanks!
|
|
|
|
|
maybe...
best way use thread pool, and each socket response object use async call back...
or anybody suggest more better solution. sorry..
|
|
|
|
|
|
Interesting.. never seen that used.. I will have to check more into that.
|
|
|
|
|
For a checkin every 30 seconds you might want to consider UDP or reconnecting each time.
The recommended way to do TCP is using the asynchronous methods; as you correctly guess creating lots of threads can cause problems. A lot of people (including myself!) start out that way because it's easy, it's how you did it in Java and the documentation for the asynchronous sockets is not that great.
What's likely to be the biggest problem in this design is that you will be using up to 750 sockets. That will be a bigger hit than the use of .Net objects with such a low load.
A quick search turned up this excellent article on high performance use of the asynchronous socket methods.
|
|
|
|
|
I haven't read that link you put up yet but I kind of skimmed through it. It appears that it is using libraries newer than .NET 2.0. I should of mentioned that I wanted to stick with nothing above .NET 2.0. Now for stuff like Labtech I really think they are using a web service (which I do not want to use). I can't really use UDP because the agent has to be able to retrieve data back from that server when it checks in. This is because the server will not really have access to any agent directly since they are on different networks. So the agent has to be the one to start the connection and accept data back.
|
|
|
|
|
I believe that NAT forwarding automatically makes 'return packet' UDP datagrams work as you'd expect, so as long as the agent started the UDP 'connection' it should be ok. I am not an expert on UDP though.
Asynchronous sockets are in .Net 2.0.
|
|
|
|
|
Only one comment - if you've got 750 clients, make sure they connect, do whatever they have to do and disconnect immediately afterwards (or force disconnect them). Holding lots of idle sockets open will kill scalability. This is the approach webservers use. And for lots of short lived connections, the threadpool is definitely your friend. When you accept a socket through a TcpListener or similar pass the socket to a method and throw it on the threadpool.
Regards,
Rob Philpott.
|
|
|
|