473,657 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling old C DLL for ASP.NET Web Service

Hi,

I need to call an old C DLL from my Web Service. This in itself is
fine and I am able to do this no problem. My issue is that I need to
call the DLL thousands of times, and it has memory leak and memory
corruption problems, so after a while it dies with a memory corruption
error. I donot have the option of fixing the memory leak, so I need
to come up with a solution.

my understanding is is the once an external dll is imported into the
ASP worker process using the dllimport command that it cannot be fully
unloaded and released (I've tried lots of examples on the net, even
calling Win32 API calls to unload the DLL).

My proposed solution is the wrap the calls to the dodgy C dll in an
out of process application written in VB6 (ActiveX EXE). As the code
will be running outside of the ASP worker process, I can then easily
release the COM object and will not have the dodgy memory corruption
in my ASP.NET app.

I know this solution will probably slow things down a hell of a lot,
but it will work ? The only option I have at the moment is to restart
IIS when the old dll goes bang.

Has anyone used this technique before, and is my proposed solutino
viable ?

Cheers
Jun 27 '08 #1
7 1521
Have you tried creating a wrapper for the DLL with TLBIMP.exe?

TLBIMP ComponentName.d ll /out:NewName.dll

That will create a .Net assembly from your C DLL.

There are exceptions (some DLL functions can't be imported into a wrapper assembly),
but for the most part TLBIMP can do the job. Try it and see.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
<ma************ **@gmail.comwro te in message news:ef******** *************** ***********@34g 2000hsf.googleg roups.com...
Hi,

I need to call an old C DLL from my Web Service. This in itself is
fine and I am able to do this no problem. My issue is that I need to
call the DLL thousands of times, and it has memory leak and memory
corruption problems, so after a while it dies with a memory corruption
error. I donot have the option of fixing the memory leak, so I need
to come up with a solution.

my understanding is is the once an external dll is imported into the
ASP worker process using the dllimport command that it cannot be fully
unloaded and released (I've tried lots of examples on the net, even
calling Win32 API calls to unload the DLL).

My proposed solution is the wrap the calls to the dodgy C dll in an
out of process application written in VB6 (ActiveX EXE). As the code
will be running outside of the ASP worker process, I can then easily
release the COM object and will not have the dodgy memory corruption
in my ASP.NET app.

I know this solution will probably slow things down a hell of a lot,
but it will work ? The only option I have at the moment is to restart
IIS when the old dll goes bang.

Has anyone used this technique before, and is my proposed solutino
viable ?

Cheers

Jun 27 '08 #2
Thanks for the response I'll give it a go and let you know how I got
on.

Cheers
Jun 27 '08 #3
It won't work for me. TLBIMP converts the type definitions found
within a COM type library into equivalent definitions in a common
language runtime assembly.

My C DLL is not a COM dll. :(
Jun 27 '08 #4
<ma************ **@gmail.comwro te in message
news:ef******** *************** ***********@34g 2000hsf.googleg roups.com...
Has anyone used this technique before,
Yes, but had to abandon it as performance degradation was unacceptable...
and is my proposed solution viable ?
Technically, yes. Practically, depends on how slow it actually is in the
real world...

I'm presuming that you no longer have the source code for the DLL...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #5
re:
!It won't work for me.
!My C DLL is not a COM dll

Drats!
It was worth a shot anyway. Sorry for not having been able to help more.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
<ma************ **@gmail.comwro te in message news:16******** *************** ***********@59g 2000hsb.googleg roups.com...
It won't work for me. TLBIMP converts the type definitions found
within a COM type library into equivalent definitions in a common
language runtime assembly.

My C DLL is not a COM dll. :(

Jun 27 '08 #6
Hi Mark,

No I don't have acesss to the old C code, so trying to fix the leak
is'nt viable.

Good to hear that technically what I am trying to achieve is possible.

One thing that is important though is performance, so the fact that
you had to abandon the venture because of performance problems might
mean that what I am trying to do might not be a sutiable solution. I
will give it a go though.

One other thing to mention, I stated originally that I need to call
the C DLL thousands of times. The C DLL is not thread safe (It's not
a great DLL :) ), however, as it will now be runnning in its own
process. I am considering using the thread pool to call it lots of
times on seperate threads. Each thread will affectively will create a
seperate process to call my C DLL. I will then get each thread to
release the out of process server when finished.

I am hoping that the speed benefits I can use by utilising multiple
threads will offset any perfomance degradation caused by created the
out of process server.

The web server I am using for the app is brand new and a decent spec
so it should be able to handle this without to much stress.
Jun 27 '08 #7
<ma************ **@gmail.comwro te in message
news:9d******** *************** ***********@m73 g2000hsh.google groups.com...
No I don't have acesss to the old C code, so trying to fix the leak
is'nt viable.
That's a shame. How large / complex is the C DLL? Do you still have the
specs / documentation for it...?
Good to hear that technically what I am trying to achieve is possible.

One thing that is important though is performance, so the fact that
you had to abandon the venture because of performance problems might
mean that what I am trying to do might not be a sutiable solution. I
will give it a go though.
I will be very surprised if you can get it to perform at an acceptable
speed...
One other thing to mention, I stated originally that I need to call
the C DLL thousands of times. The C DLL is not thread safe (It's not
a great DLL :) ), however, as it will now be runnning in its own
process. I am considering using the thread pool to call it lots of
times on seperate threads. Each thread will affectively will create a
seperate process to call my C DLL. I will then get each thread to
release the out of process server when finished.

I am hoping that the speed benefits I can use by utilising multiple
threads will offset any perfomance degradation caused by created the
out of process server.
The web server I am using for the app is brand new and a decent spec
so it should be able to handle this without to much stress.



--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2422
by: jarmopy | last post by:
Hi, I have made a service with C# and calling that service class from another C# program with remoting. (Referendes from the calling program) That service class is configured so that garpage collection is not used in this class. (singleton class + override InitializeLifetimeService ) The service class uses C++ unmanaged function from dll (using DLLimport).
0
2240
by: Cleo | last post by:
Hi, I am trying to call a WebService Method written in Weblogic from VB.NET and I am getting the following error. I am using SOAP Caal s from VB.NET. Please find the wsdl file and my code. Any help would really be appreciated. Thx
3
9077
by: Mike | last post by:
Timeout Calling Web Service I am calling a .NET 1.1 web service from an aspx page. The web service can take several minutes to complete its tasks before returning a message to the aspx page. If the web service is taking a long time to complete, the aspx page returns a ‘The operation has timed-out.’ Message to the web browser after 100 seconds. I’ve added: <httpRuntime executionTimeout="300" /> to the web.config files
3
5057
by: Jerome Cohen | last post by:
AI am trying to call a third-party web service. this service expects an XML fragment that contains the request plus other parameter. adding the web reference created the syntax below(reference.vb). I changed the data type for the structure that contains the XML data from the default "String" to "xml.xmldocument" to enable easy filling of the data. my client code creates an XML document class, fills the data using standard xml dom...
7
6013
by: Stu | last post by:
Hi, I have a web service which returns a record set and works well integrated with an asp dot net page. However if I decided to develop a unix app will i be able to read the dataset as it is or do i need to write the xml as text from the web service and supply a DTD. Also any other pitfalls TIA
5
2592
by: joeblast | last post by:
I have a Web service that gets the financial periods and hold a reference to a disconnected dataset built at initialization. Web methods work on the dataset inside the web service. Everything is fine so far. My problem is that when I call a web method to modify the dataset inside the Web service it is never updated and I get no errors. currentPeriods method will always give me 1 even if I call ChangeDataset and call currentPeriods...
1
1563
by: fallenidol | last post by:
hi i'm looking for some heads up info regarding calling and using a web service from within another web service. is this acceptable practice? if not why? what should i be thinking about here? cheers
2
2844
by: Johan | last post by:
We have run into problems calling a web service from a client running .NET framework 2.0. The problem is that the first call to the web service, after the client has been started, takes very long time, something like 15 to 30 seconds. All subsequent calls are really fast (about 10 milliseconds). But when the client is restarted, the first call once more takes long time. We have been testing a few different scenarios to figure out what is...
1
2994
by: ananth | last post by:
Hi All, I have a web service created in Notes Database and i am calling the web service in Visual studio.Net application by adding a web reference. I need to have authentication mechanism before calling the methods within the web service.I used the NetworkCredentials Property for authenticating but the user name and password is not authenticating.I am able to access the web service methods directly the authentication mechanism...
7
2677
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file name based on the name of the VB6 application. A second choice would be a file name based on the # COM interface assembly. I have tried calling Assembly.GetCallingAssembly() but this fails when I use the VB6 client. Is there a way to get this...
0
8425
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8326
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8622
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5647
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1736
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.