Publishing web site wipes out my web services




I think I need a "best practices" lesson on web sites and web services.
In order to conform to the restraints of my web host, my web services
seem to need to be in a subfolder of my web site. So if I have a
wwwroot folder containing my site, which maps to, then
to reference my web service, MyService, I place it in a folder that
maps to wwwroot/MyService/MyService.asmx. This is dandy. I reference
it by using the URL,, in
my WinForms application. The problem is that if I decide to make a
change to my web site and "publish" it, it tells me it is going to
delete the existing files, and it does; every file including my web

As a big band-aid, we moved the services to a folder up at the same
level as the wwwroot and the web host tech support guy did some behind
the scenes magic so that I could refer to it with a subdomain, He says that as soon as I do
anything with the control panel, it will break things. Also, this
seems like a bad way to deal with this.

How do I publish without deleting web services that are in subfolders
of my web site? Essentially, what is the best practice for having a
web site coexist with a completely separate web service?


How do I position them so that no magic has to be performed by the web
host and nothing willl get broken when I change something in my control

Naturally, this needs to be locked down because if the web service is
moved, applications compiled against the web service will break.




I'm going to list the contents of a few files.
If the line has the prefix "+++", then this line is NOT in the file.

+++ Start BuildDefault.bat contents
:The below file contains a summary of each build
del BuildDefaultResultsRelease.txt

:The recompile of your soluction.
:You will need to rename MyDotNetSolution.sln to your .sln name
:Notice that this file will be in the same directory AS THE SOLUTION (.sln)
"C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe"
MyDotNetSolution.sln /rebuild Release /out BuildDefaultResultsRelease.txt

:Xcopy the germane items
:The directory c:\wutemp\MySolution_Deploy\ should already exist (you can
name it anything)
:and it should be empty (or you get a bunch of "Overwrite file?" messages
:Also notice it uses the file XCopyExcludes.txt (which should also be in the
same directory as the .sln file)
xcopy *.* c:\wutemp\MySolution_Deploy\*.* /E /R /EXCLUDE:.\XCopyExcludes.txt

+++ End BuildDefault.bat

+++++ Start XCopyExcludes.txt contents
++++ End XCopyExcludes.txt contents

Put both of these files in the directory with your .sln file.

Edit the bat file for your situation.
MyDotNetSolution.sln will need to be changed.
c:\wutemp\MySolution_Deploy\ should be changed and its easier if this
directory exists ~before running the .bat file.
C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe
needs to reflect your location.


After you get your results, you can copy them over to a hosting company.

This is alot less drama in my book .... then the "publish" wizards.

If your in 2.0, then you can't "exclude"

You may have to alter the
xcopy *.*
to match up to what you're deploying. Sometimes you just get the /bin
folder (winforms),
xcopy *.* is for web sites.


Get away from this whole thing of the "Web Site" project model. Download and
install the Web Application Project add-in, and you will find that the
semantics of updating a web site are as simple as copying (or ftp-ing) over
the /bin folder and all the .aspx / etc. files above it.

IMHO, the Web Application Project option, which was provided primarily
because of developer feedback to Scott Guthrie and his ASP.NET 2.0 team, is
far superior.



I have used the Web Application Project for converting a .NET 1.1 web
site to 2.0 and while it made that process much simpler, it seemed to
make it lose functionality in the IDE, namely no Publish option and no
copy option. Maybe I just haven't found them yet. I'm also
considering trying to "publish" locally to get the compiled files I
need and then FTPing them to the web host so that it doesn't delete
everything in sight. How about that?



// I'm also
considering trying to "publish" locally to get the compiled files I
need and then FTPing them to the web host so that it doesn't delete
everything in sight. How about that?////////

That's what my stuff below is all about.

It builds in "release" mode, copies only the needed files to a seperate
directory. Then you can ftp from the seperate directory.



Sorry. It's been decades since I've used anything like XCopy. To me
it looked like a lot more work than just

1) compiling
2) opening an FTP connection with IE
3) dragging the files.

I didn't mean to dismiss it. I don't think I need to set up exclude
files, etc. I'll try my steps above first. If that doesn't work, then
that's only 2 minutes wasted.

Thanks for your suggestion. Right now just getting my web host to give
me useful information and not ignore me is a more urgent matter.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question