Confused about Deployment (ASP.NET Web Application vs ASP.NET Web Site)

Last post 06-15-2009 7:13 PM by Sounge. 8 replies.

Sort Posts:

  • Confused about Deployment (ASP.NET Web Application vs ASP.NET Web Site)

    10-25-2008, 4:37 PM
    • Member
      89 point Member
    • Sounge
    • Member since 02-25-2005, 11:56 AM
    • Posts 47

    I am having difficulty publishing my ASP.NET website when my project is of type "ASP.NET Web Application" (I created a new project by File -> New Project -> Visual C# -> ASP.NET Web Application).  When I choose "Publish Web Site", it asks me to select the folder to publish to, which works fine.  I notice, however, in the 'published' default.aspx page (the only page in my project) that it is pointing to "Default.aspx.cs" for the CodeFile, however, the Published web site only has a .DLL in the \bin folder, named [Projectname].DLL, but its not being referenced anywhere or anything.

     I created another project of type "ASP.NET Website", by going to File -> New Website -> ASP.NET Website, used the same source files, did a build, and then published the site, and it works great.

     Any ideas on how/why this is happening? Also, what is the exact difference by an 'ASP.NET Web Application' and an 'ASP.NET Website' when creating a new project?

    Many thanks in advance.

  • Re: Confused about Deployment (ASP.NET Web Application vs ASP.NET Web Site)

    10-28-2008, 2:49 AM
    Answer

    Hi,

    ASP.NET Web Application project (http://msdn.microsoft.com/en-us/asp.net/aa336618.aspx) is closer to the Visual Studio .NET 2003 Web Project model and compiles all of the source code files during the build process and generates a single assembly in the local /bin directory for deployment. After we use Publish feature to publish web application, we can remove the "CodeFile" from Page directive, instead, CLR uses Inherits to load type.

    In ASP.NET Website project, the compiler will remove CodeFile attribute and change the Inherits attribute to include the assembly name.

    This is by design.

     

    I look forward to hearing from you.

    Thomas Sun
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
  • Re: Confused about Deployment (ASP.NET Web Application vs ASP.NET Web Site)

    11-04-2008, 3:57 PM
    • Member
      89 point Member
    • Sounge
    • Member since 02-25-2005, 11:56 AM
    • Posts 47

     Thank you for the reply.  So, if I am starting a new project in Visual Studio 2008, I shouldn't choose "Web Application Project" but instead should choose "ASP.NET Web Site" every time?

  • Re: Confused about Deployment (ASP.NET Web Application vs ASP.NET Web Site)

    11-04-2008, 9:05 PM

    Hi,

    Thanks for your response.

    They are both working. You can choose the one you prefer to work with.

     

    Thanks.

    Thomas Sun
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
  • Re: Confused about Deployment (ASP.NET Web Application vs ASP.NET Web Site)

    11-05-2008, 12:11 PM
    • Member
      89 point Member
    • Sounge
    • Member since 02-25-2005, 11:56 AM
    • Posts 47

    I am still having difficulty with an ASP.NET Web Application.  I created a new project, and it created a Default.aspx page (as well as the .cs codebehind page).  I just created a sample label and in the CodeBehind I assigned a string to the label Text property.  I built the page and ran it from Visual Studio, and it works.

    I then tried using the 'Publish' command and I published it to a folder on my computer.  That folder now has a default.aspx file, but no more .aspx.cs file as it compiled it in a .DLL file in the Bin folder.  However, when I open up that Default.aspx file that was 'published', in the Page directive it is still trying to reference "CodeBehind=Default.aspx.cs".  However, obviously since it is now compiled that file is not there, instead there is a DLL file in the \Bin folder.

     a) How do I fix this so that it properly references that DLL file that was compiled and published?

    b) How do I set it up so that every time I compile/publish the project it doesn't show the CodeBehind=Default.aspx.cs anymore in the Page directive since obviously it doesn't exist?

     Thanks.

  • Re: Confused about Deployment (ASP.NET Web Application vs ASP.NET Web Site)

    11-07-2008, 1:07 PM

    I am having the same problem in VS2008. I have been pounding my head against the keyboard for some time now trying to get this to work. I tried publishing using the option "All Project files" and that works fine. But since everything I've read insists that this is a one-click solution, I manually deleted all the file from the destination directory and published the project again with the "Only files needed to run this application" and out of nowhere it started working. I can't explain why though. Any other insight into the matter would be appreciated.

     For what it's worth, the web application .aspx file still shows "<%@ Page Language="C#" AutoEventWireup="true" Codebehind="MyPageName.aspx.cs" Inherits="MyNamespace.MyPageName" %>"

  • Re: Confused about Deployment (ASP.NET Web Application vs ASP.NET Web Site)

    01-09-2009, 10:55 AM
    • Member
      89 point Member
    • Sounge
    • Member since 02-25-2005, 11:56 AM
    • Posts 47

     *bump*

     any help would be greatly appreciated.

  • Re: Confused about Deployment (ASP.NET Web Application vs ASP.NET Web Site)

    02-13-2009, 7:50 AM
    • Member
      2 point Member
    • Jeremy Lunn
    • Member since 02-13-2009, 12:45 PM
    • Posts 1

    Change CodeFile to Codebehind on your form then the deployment will work.

    This works for all types of web projects.

    Cheerio Jeremy

  • Re: Confused about Deployment (ASP.NET Web Application vs ASP.NET Web Site)

    06-15-2009, 7:13 PM
    • Member
      89 point Member
    • Sounge
    • Member since 02-25-2005, 11:56 AM
    • Posts 47

    I am bumping this up because I am still having difficulty.  I created a new ASP.NET Web Application, with just one file (default.aspx).  I saved it, compiled it, and used the "Publish" option.  I chose the default option, "Copy Only files needed to run this application", and saved it to a folder.  However, when I look at the default.aspx file, it is trying to access the default.aspx.cs codebehind file, but it doesn't exist since it wasn't published.

    If I publish using the "Copy All Project Files"  option, it does copy ALL the project files, including the codebehind.  However, I was under the assumption that the whole point of ASP.NET when you compile is that you don't have access to the source code when you publish it? 

    What is the proper way to deploy/publish "ASP.NET Web Application" types in VS2008? I am really confused.

    Many thanks for any help.

Page 1 of 1 (9 items)