I have two questions about Visual Studio 2005 and MFC ISAPI extension DLLs:
- Has there been a change to how MFC ISAPI extension DLLs work after
being recompiled with VS2005? I am getting faults in mine.
- The “MFC ISAPI Extension Project” icon does not appear in the new
project wizard as the MSDN documentation says it should. In another post
about this in December, 2005, Steven Cheng responded that it is under the ATL
Server icon, but when I tried this it results in a considerably different
project than what the documentation discusses.
I am using VS2005 Team Edition for Software Developers, and the language is
C++. I have an ISAPI DLL that was written with Visual Studio v6, and
compiles and runs fine on IIS running under both Windows Server 2003 Web
Edition and Windows XP. The program routes all incoming messages to the
default function. When I convert and recompile the program using VS2005, the
behavior changes. The web server extension class gets fired up and the
constructor is executed, but no message ever gets to the default function.
The DLL is terminated immediately, so a second message results in the DLL
being fired up again by IIS. A fault appears in the application log.
I thought I would attempt to diagnose the situation by creating a dummy MFC
ISAPI extension DLL using the wizard, and see if it worked OK, but as I noted
above I can’t find the VS2005 wizard to create one. So. to demonstrate the
problem, I used the VS6 wizard to create an ISAPI extension DLL, and modified
it to receive a string and send it back as a response with the date and time
prepended to it. That works fine. I then converted and compiled the program
using VS2005, and it won’t work. The application event log shows the
following text “Faulting application w3wp.exe, version 6.0.3790.1830,
faulting module Test_ISAPI_DLL.dll, version 1.0.0.1, fault address
0x000025c5.” It’s event ID 1000, category 100. I also changed the the
default function to just send back a message saying it received a message
without including the text it received, and that failed with the same
problem.
Thanks.
j.a. harriman - 10 May 2006 20:49 GMT
Wanted to add VS2005 code snippets from a test pgm:
///////////////////////////////////////////////////////////////////////
// command-parsing map
BEGIN_PARSE_MAP(CTest_ISAPI_DLLExtension, CHttpServer)
// TODO: insert your ON_PARSE_COMMAND() and
// ON_PARSE_COMMAND_PARAMS() here to hook up your commands.
// For example:
ON_PARSE_COMMAND(Default, CTest_ISAPI_DLLExtension, ITS_PSTR)
DEFAULT_PARSE_COMMAND(Default, CTest_ISAPI_DLLExtension)
END_PARSE_MAP(CTest_ISAPI_DLLExtension)
void CTest_ISAPI_DLLExtension::Default(CHttpServerContext* pCtxt,
LPCTSTR p_msg_in)
{
CString s;
CTime ct = CTime::GetCurrentTime();
s.Format("%s Received this msg: %s<BR><BR>",
ct.Format("%m/%d/%Y %H:%M:%S"),
p_msg_in);
StartContent(pCtxt);
WriteTitle(pCtxt);
*pCtxt << (LPCTSTR)s;
EndContent(pCtxt);
}
VS6 code snippets from a test pgm:
///////////////////////////////////////////////////////////////////////
// command-parsing map
BEGIN_PARSE_MAP(CTest_ISAPI_DLLExtension, CHttpServer)
// TODO: insert your ON_PARSE_COMMAND() and
// ON_PARSE_COMMAND_PARAMS() here to hook up your commands.
// For example:
ON_PARSE_COMMAND(Default, CTest_ISAPI_DLLExtension, ITS_PSTR)
DEFAULT_PARSE_COMMAND(Default, CTest_ISAPI_DLLExtension)
END_PARSE_MAP(CTest_ISAPI_DLLExtension)
void CTest_ISAPI_DLLExtension::Default(CHttpServerContext* pCtxt,
LPCTSTR p_msg_in)
{
CString s;
CTime ct = CTime::GetCurrentTime();
s.Format("%s Received this msg: %s<BR><BR>",
ct.Format("%m/%d/%Y %H:%M:%S"),
p_msg_in);
StartContent(pCtxt);
WriteTitle(pCtxt);
*pCtxt << (LPCTSTR)s;
EndContent(pCtxt);
}
"Gary Chang[MSFT]" - 11 May 2006 08:18 GMT
Hi Jeffery,
Thank you posting!
Just as Steven Cheng figured, VC2005 use the ATL server project to create
its corresponding ISAPI extension DLL. It doesn't provide an MFC ISAPI
extension DLL project type. You can find the VC2005's ISAPI Extension DLL's
information in the following MSDN2 link:
http://msdn2.microsoft.com/en-us/library/thhyw4fc.aspx
By the way, since VC2005 use a new MFC library from the VC6, and also
VC2005 doesn't have a corresponding MFC ISAPI extension DLL project
building configuration. Your upgraded VC6 MFC ISAPI extension DLL would not
work as expect after being recompiled under VC2005. In this regard, I don't
suggest you convert your VC6 MFC ISAPI ext DLL project to VC2005.
Thanks for your understanding.
Best regards,
Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
kentp - 11 May 2006 15:08 GMT
Jeff posted this question for me. I now have some follow-up questions.
The purpose of our ISAPI DLL is to receive HTTP messages and process them.
Everything goes to the default function, and after a small amount of
examination of the message it is stored for other programs to process it.
The program is intentionally kept dumb and simple, the processing logic is
put into other programs.
I generated an ATL server project and it looks like it's going to take a
whole bunch of time to learn what it is doing and how to fit our functions
into it. The wizard appears to be generating a lot of code that we don't
need, but since I don't know what it is for I don't know what I can delete.
What I'd like to do is to skinny down an ATL project to the absolute bare
bones, then add our code to it. Does anyone have an example like that? Or,
is there a better method I should use to just receive a message that's been
posted to a web server? MFC has to be involved because our code uses several
of our DLLs that contain various required functions, and those DLLs are MFC
Regular DLLs.
Converting over 1,000 C++ programs from VS6 to VS2005 has been something of
a nightmare because there is no guide I can find to tell me what changes have
been made to the C++ compiler, and no tools to convert the projects (per
Microsoft, you need to click on each project and let VS2005 do the
conversion). As a result I have had to write programs to convert the
projects, and then test and change the programs when I find problems, then do
the same thing all over again until all of the problems are fixed. I'm now
down to just a few problems, this one being that our one ISAPI DLL won't work
after being converted. But I just can't spare a week or more to learn how to
recreate this basic functionality because Microsoft has abandoned their ISAPI
programming model rather than providing some type of simple transition. I
would appreciate any suggestions you might have on how I can easily migrate
this program.
Thank you, I appreciate the help.
"Gary Chang[MSFT]" - 12 May 2006 04:44 GMT
Hi Kent,
I am afriad this is a break change in VC2005, I apologize for any
inconvenience this may cause you. If you would like to make a suggestion
on how to improve our products please provide your feed back at:
http://lab.msdn.microsoft.com/productfeedback/default.aspx
Thanks!
Best regards,
Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.