Solved

Problem upgrading ISAPI Extension from VC++5.0 to VC++.NET

Posted on 2004-04-04
6
319 Views
Last Modified: 2013-11-25
Hi Experts:

I have this app. that is running for almost 2 years now. It consists of an application server that is accessed by the ISAPI dll - both writen in C++ - on the server side. On the client side it has an Active/X control (.ocx) embedded in regular HTML that creates an http session with the isapi dll thru the IIS and communicates with it. This ocx is written in MFC based C++.

All this is in use on an NT4.0 server with IIS 4.0. Now I am upgrading it to Windows 2000 , IIS 5.0 and VC++.NET.

So far, all VC++5.0 modules install and run OK in the new server. The problem arises with the .NET version of the ISAPI Dll, which is compiled in the same server. I placed traces that write to the event viewer from each method of the isapi extension and found out that only the constructor and the GetExtensionVersion method are getting invoked, while the Default method is not. The funny thing is that when the same code is compiled using VC++5.0 on a win95 pc, everything works fine.

The following data refers to the environment I have on my lab to get this thing to work:

SERVER
------
Windows 2000 5.00.2195 - Service Pack 2
IIS 5.0
Visual C++.NET
  MS Development Environment 2002 Version 7.0.9500
  MS .NET Framework 1.0           Version 1.0.3705

CLIENT
------
Windows 98 Second Edition
IE 5.00


Regards

Julio
0
Comment
Question by:juliogonzalez
  • 3
  • 3
6 Comments
 
LVL 4

Expert Comment

by:YuriPutivsky
ID: 10761745
Check the dependeces of your new DLL. Probably the .Net code linked to your C++ code depends on the some new DLL(s) loaded dynamically at run-time and you didn't put it on IIS computer.
0
 

Author Comment

by:juliogonzalez
ID: 10766564
Hi Yuri,

There are 2 facts I´d like to mention now.
First is that I forgot to mention that just in order to prevent this kind of dependences problem, the DLL is linked to MFC as a static library. Second, the DLL is actually running (it is posting events to the event viewer from 2 methods) but the "Default" method does not receive control at any time.
This means to me that when the first request for the dll comes from the client, the IIS loads and instantiates the dll (which in turn posts the trace events from the methods mentioned) and then the IIS fails to locate the entry point for the "Default" method, and nothing more happens with the dll, until the IIS is restarted. At this time, the IIS terminates the dll, what I can see in the event viewer by an event posted by the dll destructor method.
When I found out that just one method was not being invoked, I tried to fix it in the .def file wher the wizard didn´t include default as an export. First the linker failed because it found redundancies with the name "default" and asked for a decorated name. Then I got this decorated name (without fully understandig the rules of decoration) using the dumpbin utility and put it in the .def, forcing the linker to success.
But the results were the same, whether omitted or included decorated in the .def, the default method is not getting invoked.

Should I try using MFC as a DLL? What is a decorated name? Why do I get duplicates when I put Default(undecorated) in the .def?

Thanks for your comments, and looking forward for further comments.

Julio
0
 
LVL 4

Expert Comment

by:YuriPutivsky
ID: 10767267
IIS invokes GetExtensionVersion when it loads DLL first time then only HttpExtensionProc. Even you defined in *.def file "Default" method it doesn't change anything. Check if HttpExtensionProc in *.def file. And if yes add some traces up to Default method call walking though the code.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:juliogonzalez
ID: 10768525
HttpExtensionProc is in *.def file already. Default method is starting with a trace, this is how I notice it´s not being invoked.
0
 
LVL 4

Accepted Solution

by:
YuriPutivsky earned 500 total points
ID: 10768744
You can trace it. Put trace staements starting from HttpExtensionProc. Or even better you can do it under debug and see what's going on exactly.
0
 

Author Comment

by:juliogonzalez
ID: 10770913
Hi Yuri,

There was no HttpExtensionProc override in the original code, the wizard didn´t put it either and it was needed never before. So I added it by hand just to place a trace as you suggested and .... voila !! Now everything works fine. It looks like, for some reason, the new compiler requires this override to be coded by hand in the dll extension.
Thank you very much for your help. The 500 points and the grade are yours, but it is much more what you deserve.

Julio
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now