Re: How to Deploy C++ Web Service?

Eddie Lascu <[email protected]> Mon, 28 Jun 2004 15:31:01 -0400
Newsgroups gmane.comp.windows.devel.soap.general
Message-ID <[email protected]>
Hi Siegfried,

There is a major difference between creating C++ and C# Web Service
projects. The difference appears when you want to specify where the project
should be located.

I created two folders called "NewCSharpWebSrvc" and "NewCPPWebSrvc". I Web
Shared both of them (which is equivalent with adding them as virtual
directories within IIS).

When creating the C# WS project, In the "Add New Project" dialog box, the
"Name" field is disabled and you can only enter the location. The location
must (or can) be relative to the localhost directory. The name of the
project will be filled in automatically, as you type the location. The
Project is created in the right place, compiles and works perfect. Nothing
else gets created in the "C:\Inetpub\wwwroot".

With C++ projects, things are not going that smooth. First difference is
that both fields "Name" and "Location" are enabled in the "Add New Project"
dialog box. The Location cannot be specified via a relative path (something
like "http:\\localhost\NewCPPWebSrvc") because the OK doesn't activate to be
pressed. You have to go "D:\MyTestFolder\NewCPPWebSrvc". So far so good, but
when you compile the project, Visual C++.NET copies some file to the
"C:\Inetpub\wwwroot" folder. It turns out, those are the most important
files, because the \bin folder gets created only there. Furthermore, now
there are two folders called "NewCPPWebSrvc": one where I created the
project and it is Web Shared and the other one in the "C:\Inetpub\wwwroot"
folder. Apparently, the ASP.NET discovers the first one first, but that
doesn't have the \bin folder that contains the .dll file required to run the
Web Service. Hence the Web Service doesn't run and gives an error.

I guess all the problems would be solved if I can somehow tell Visual
C++.NET not to output the built files to the "C:\Inetpub\wwwroot" folder,
but leave them locally. My CPP Web Service starts to work as soon as I bring
the \bin folder in the Web Shared "NewCPPWebSrvc" folder. Obviously, I would
have to do this every time I recompile the CPP Web Service.

This is an excerpt from the Output panel from when I compile the CPP Web
Service"

Source and destination files were identical. File not copied
(d:\MyTestFolder\NewCPPWebSrvc\NewCPPWebSrvc.asmx)
Source and destination files were identical. File not copied
(d:\MyTestFolder\NewCPPWebSrvc\Web.config)
Source and destination files were identical. File not copied
(d:\MyTestFolder\NewCPPWebSrvc\Global.asax)
Copied file from d:\MyTestFolder\debug\NewCPPWebSrvc.dll to
c:\inetpub\wwwroot\NewCPPWebSrvc\bin\NewCPPWebSrvc.dll
Copied file from D:\MyTestFolder\Debug\NewCPPWebSrvc.pdb to
c:\inetpub\wwwroot\NewCPPWebSrvc\bin\NewCPPWebSrvc.pdb

Any idea how to inhibit this behavior?

My solution was to create some post-compile commands that bring those file
where I need them to be, but I hope that there might be some other ways to
do it too.

I hope this will help you,
Eddie


-----Original Message-----
From: Discussion of implementing SOAP applications today
[mailto:[email protected]]On Behalf Of Siegfried Heintze
Sent: Sunday, June 27, 2004 4:12 PM
To: [email protected]
Subject: [SOAP] How to Deploy C++ Web Service?


I'm so frustrated! While my preferred approach is still to call a C DLL from
C# Web Service, I thought I would try another approach while waiting for a
response.



I created a C++ service using Visual Studio 2003. I then hit CTRL-F5 and
verified the HelloWorld worked. I then looked all over Visual Studio 2003
and could not figure out how to deploy the beast. The C# Studio has the copy
project menu entry: not so for C++! Why not?



So I fired up Front Page and created a new web directory on my remote
hosting service by first creating a folder and then right clicking on it to
convert it to a web folder. Then I used FTP to drag and drop all the files
Visual Studio 2003 created to the new web folder. Then I point my browser at
the asmx file and I get this as a result (see below). I did not touch
anything between testing it out on my local instance of IIS (where it
worked!) and the FTP (oh -- I did have to create a Web.Config file to see
the error message but that is all).



Here is the asmx file contents (just one line):

<%@ WebService Class=AnalyzeCase.AnalyzeCaseClass %>



The C++ source code is only the stuff the Visual Studio 2003 class wizard
generates by default. I did not modify it! Honest!



 So it worked locally! Why not on my hosting service?

  Thanks,

    Siegfried



Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.

Parser Error Message: Could not create type 'AnalyzeCase.AnalyzeCaseClass'.

Source Error:


Line 1:  <%@ WebService Class=AnalyzeCase.AnalyzeCaseClass %>
Line 2:


Source File:
C:\Inetpub\websites\evidence\stage\htdocs\AnalyzeCase\AnalyzeCase.asmx
Line: 1