Share via


Deploying ASP.NET Applications

We recently published an article in the MSDN FrontPage portal called
Using ASP.NET with FrontPage.  The article does well, but there's one complaint from a reader that the article doesn't address how to make an ASP.NET project run on a Web server. 
I'm not sure the article should, but I remember having that same question with the first ASP.NET app I actually
copied to a server.  It wouldn't run, and there were no clues as to what I needed to do to make it run. 
I even tried creating a Web app directly on the server to see if that would
help.  It didn't.

I was certain it was a server problem and not a code problem, since I could
run the application fine on my machine just not on the server.  The .NET
Framework was, of course, installed and running. So I did some research and what
I found was a help topic that said that ASP.NET deployment is as simple as
copying the necessary files to the Web server.  Okay, I did that without
success, so what was I missing?

When I was in college, I had a writing instructor who used the term COIK
writing:  Clear Only If Known.  Many technical writers mistakenly make
assumptions about their readers.  Now I'm not saying that all assumptions
are bad or wrong.  For example, as a programmer writer, I have to assume
that my readers at least know what code is if they haven't actually written it
before.  But there are just some assumptions that shouldn't be made.

With the help for deploying ASP.NET applications, the assumption was that I
understood what needed to be done on the server in order to make my Web app run,
making the additional information unnecessary.  Perhaps I should have
known; I've certainly worked with IIS, but (as I've said before) servers are not
my thing.  In the past, I've preferred to leave them to others, but I've
realized that if I want to provide server-side anything on my Web sites, I need
to know as much as, if not more than, my Web server admins about what the server
needs to do and how to do it.

The help for deploying ASP.NET applications wasn't incorrect.  You can,
in fact, copy ASP.NET files to the server using XCopy or an FTP program,
provided you know which files you need to copy.  However, deploying a Web
app is more than just copying the necessary files to the Web server.  So
what else needs to be done?

In the IIS Properties pages for a Web site's virtual directory, there
is a Directory tab that contains the application settings.  By
default, when an admin creates an IIS Web site (or virtual directory), the
application name is empty or says "Default Application" in greyed text. 
All you need to do is click Create to tell IIS to run server-side code
from the Web sites virtual directory.

The folder into which you copy or FTP the files for an ASP.NET Web
application may be a subfolder in your Web site but may not be a virtual
directory in IIS.  In this case, your Web server admin needs to add it as a
virtual directory in IIS.  Either way, the admin also needs to set the
application settings for the virtual directory.

Of course, this is a simplified version of what needs to be done, and I'm
sure there are other settings that Web developers may need to know to
effectively deploy ASP.NET applications, but every Web app that I created before
knowing this, that previously didn't work, now functions as expected after
clicking Create.  Isn't it wonderful when things work?

Comments

  • Anonymous
    May 19, 2004
    Glad to hear I'm not the only one who struggled with this at first!

    One question though, which may or may not have an easy answer (I really don't know):

    This is fine and easy if you're admin on the IIS server, but what if you're not (ie: your hoster is, you just 'own' a particular directory tree). The only access you have to the server is through FTP. Is there a purely filesystem-based way to get an application up and running or must you really depend on the hoster to eventually get around to defining that directory as an application?
  • Anonymous
    May 20, 2004
    Hi, J-P,

    Unfortunately, there isn't. The only way to successfully deploy an ASP.NET Web app is to copy it to an IIS virtual directory that has the application settings fixed (as I describe above) to allow running application code. It's unfortunate, but there's no way around this.

    If you already have a folder configured to allow an ASP.NET Web app, you can use it. Otherwise, you have to call your admin and request that they add the folder as a virtual directory and set the application properties.
  • Anonymous
    May 20, 2004
    Thanks so much for clarifying!
  • Anonymous
    June 17, 2004
    I noticed that Visual Studio.NET 2003 has the ability to copy a project (See Project > Copy Project) which some web-sites document to use for deploying your web-site to a remote server. My question, there doesn't appear to be an option of using FTP information as a web access method, is this possible? And secondly when it copies the files ideally I'd like only the files that were changed to be uploaded. Possible ?