Re: Manually Created Web Site Does Not Work - What am I Missing?

Discussion in 'ASP .Net' started by Juan T. Llibre, Oct 5, 2008.

  1. re:
    !> 2. Copied all of the site's dll and ascx files into the folder structure,
    !> with all of the dlls going into the bin folder, as in the VS project's folder structure.

    You can't do that.

    Dll's in the bin directory have a naming convention based on the Application's name.
    That's why you're getting the error.

    Your second application is trying to find application2.dll in its /bin directory,
    but only finds application1.dll in its /bin directory.

    To solve this, *don't* copy the dlls for the 1st app into the 2nd app's /bin directory.

    Create a new VS 2008 blank project, add your aspx/ascx/config/asax files and compile the new project.
    VS will automatically create the bin dlls with the correct name.

    *Now*, you can copy all of the site's dll and ascx files into the virtual folder structure.




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Jordan S." <> wrote in message news:...
    > On my XP Pro dev box I have created an ASP.NET Web application using Visual Studio 2008 pro. It works great. I then
    > went to manually create a copy of the Web site, with a different name, on the same machine. I did the following, and
    > the Web site fails to start with a 403 error, or a 404, depending on the particular resource requested.
    >
    > Here are the steps I have performed:
    > 1. Created a new NTFS folder structure, with a \bin folder under the site's root folder.
    >
    > 2. Copied all of the site's dll and ascx files into the folder structure, with all of the dlls going into the bin
    > folder, as in the VS project's folder structure.
    > (note: there are zero aspx files in this site, as all pages requests are served via custom http handler factory)
    >
    > 3. Set the NTFS permissions to be the same as those for the same project as created under Visual Studio - including
    > for the ASP.NET account.
    >
    > 4. Manually created the Web site (web application virtual directory) in IIS (mmc snap-in), being careful to keep the
    > permissions and capabilities the same as those for the Web application virtual directory that Visual Studio had
    > created for the original project.
    >
    > 5. Ran aspnet_regiis -s on the new Web site... it ran to completion normally (no error messages when it ran).
    >
    > 6. Restarted IIS (via MMC snap-in).
    >
    > After all of the above, the site fails to start. In Global.Init, I write to an Application event log... writing a
    > brief message stating that the Web site started. No such message appears in the event log. In my custom override of
    > Global.Init, I also have good exception handling that writes a warning or error message to the event log. No such
    > messsage appears. Also, during my custom override of Global.Init, I have logic that connects to and queries a local
    > SQL Server database. As I monitor DB activity, the database receives no attempts to connect from this particular
    > ASP.NET Web application.
    >
    > So it's as if this thing isn't starting at all - at least not my custom logic. If I create a really simple
    > default.aspx file (with static html only and no code-behind), then that is served to the browser just fine. But even
    > in these cases, nothing else works (as described above... no messages written to the event log, so I know my custom
    > Global.Init isn't running.
    >
    > What could I be missing? What to do now? Thanks!
    >
    >
    >
    >
     
    Juan T. Llibre, Oct 5, 2008
    #1
    1. Advertising

  2. re:
    !> I was hoping that my Web site (#2) would not need to
    !> have the same name or folder structure as my VS project.

    Your website doesn't need to have the same name. Your VS project must.

    re:
    !> if that's my only or best option.

    You can also compile the assemblies manually from the command-line,
    using either msbuild or the language compiler your application uses.

    I am curious about this that you wrote:

    !> 3. Set the NTFS permissions to be the same as those for the same project
    !> as created under Visual Studio - including for the ASP.NET account.

    As you may, or may not, know, the accounts ASP.NET runs as are different
    for the ASP.NET Web Development Server embedded into VS 2008...and IIS.

    The ASP.NET Dev Server runs as the Administrator account in VS 2008.
    When running ASP.NET in IIS 5.1/XP, the account ASP.NET uses is the ASPNET (no dot) account.

    That may also affect your database functionality, since the account name passed to
    your SQL Server database, if you're not using ad-hoc authentication, will be different in each case.

    To which account did you grant read/write permissions to ?

    If you're not sure which account ASP.NET is running as, run this script I wrote :

    identity.aspx :
    ---------------------
    <%@ Page Language="VB" %>
    <%@ Import NameSpace = System.Security.Principal %>
    <script runat="server">
    Sub Page_Load()
    Dim tmp As String = WindowsIdentity.GetCurrent.Name()
    Label1.Text = "ASP.NET is running as the account : " & tmp
    End Sub
    </script>
    <html>
    <head>
    <title>What account is ASP.NET running as ?</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
    </div>
    </form>
    </body>
    </html>
    -----------

    Running that script will tell you which account ASP.NET is running as.
    *That* will be the account which needs NTFS permissions.

    You may want to run the script in both environments ( VS 2008 and IIS ),
    so that you can check that there's a different result for each.




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Jordan S." <> wrote in message news:...
    > Thanks Juan,
    > I can certainly do as you suggest, and will gladly do so if that's my only or best option.
    >
    > I was hoping that my Web site (#2) would not need to have the same name or folder structure as my VS project. I plan
    > to copy this ASP.NET Web application for use by multiple customers. Is there any way I can tell ASP.NET to use the dll
    > files from App #1 in the /bin directory of App #2 even though the name doesn't match? Perhaps I'm totally missing some
    > important point here. If so, where can I read up on this naming convention? (I'm not sure what terms to search google
    > on for this).
    >
    > Thanks again.




    > "Juan T. Llibre" <> wrote in message news:%...
    >> re:
    >> !> 2. Copied all of the site's dll and ascx files into the folder structure,
    >> !> with all of the dlls going into the bin folder, as in the VS project's folder structure.
    >>
    >> You can't do that.
    >>
    >> Dll's in the bin directory have a naming convention based on the Application's name.
    >> That's why you're getting the error.
    >>
    >> Your second application is trying to find application2.dll in its /bin directory,
    >> but only finds application1.dll in its /bin directory.
    >>
    >> To solve this, *don't* copy the dlls for the 1st app into the 2nd app's /bin directory.
    >>
    >> Create a new VS 2008 blank project, add your aspx/ascx/config/asax files and compile the new project.
    >> VS will automatically create the bin dlls with the correct name.
    >>
    >> *Now*, you can copy all of the site's dll and ascx files into the virtual folder structure.
    >>
    >>
    >>
    >>
    >> Juan T. Llibre, asp.net MVP
    >> asp.net faq : http://asp.net.do/faq/
    >> foros de asp.net, en español : http://asp.net.do/foros/
    >> ======================================
    >> "Jordan S." <> wrote in message news:...
    >>> On my XP Pro dev box I have created an ASP.NET Web application using Visual Studio 2008 pro. It works great. I then
    >>> went to manually create a copy of the Web site, with a different name, on the same machine. I did the following, and
    >>> the Web site fails to start with a 403 error, or a 404, depending on the particular resource requested.
    >>>
    >>> Here are the steps I have performed:
    >>> 1. Created a new NTFS folder structure, with a \bin folder under the site's root folder.
    >>>
    >>> 2. Copied all of the site's dll and ascx files into the folder structure, with all of the dlls going into the bin
    >>> folder, as in the VS project's folder structure.
    >>> (note: there are zero aspx files in this site, as all pages requests are served via custom http handler factory)
    >>>
    >>> 3. Set the NTFS permissions to be the same as those for the same project as created under Visual Studio - including
    >>> for the ASP.NET account.
    >>>
    >>> 4. Manually created the Web site (web application virtual directory) in IIS (mmc snap-in), being careful to keep the
    >>> permissions and capabilities the same as those for the Web application virtual directory that Visual Studio had
    >>> created for the original project.
    >>>
    >>> 5. Ran aspnet_regiis -s on the new Web site... it ran to completion normally (no error messages when it ran).
    >>>
    >>> 6. Restarted IIS (via MMC snap-in).
    >>>
    >>> After all of the above, the site fails to start. In Global.Init, I write to an Application event log... writing a
    >>> brief message stating that the Web site started. No such message appears in the event log. In my custom override of
    >>> Global.Init, I also have good exception handling that writes a warning or error message to the event log. No such
    >>> messsage appears. Also, during my custom override of Global.Init, I have logic that connects to and queries a local
    >>> SQL Server database. As I monitor DB activity, the database receives no attempts to connect from this particular
    >>> ASP.NET Web application.
    >>>
    >>> So it's as if this thing isn't starting at all - at least not my custom logic. If I create a really simple
    >>> default.aspx file (with static html only and no code-behind), then that is served to the browser just fine. But even
    >>> in these cases, nothing else works (as described above... no messages written to the event log, so I know my custom
    >>> Global.Init isn't running.
    >>>
    >>> What could I be missing? What to do now? Thanks!
    >>>
    >>>>

    >
    >
    >
     
    Juan T. Llibre, Oct 5, 2008
    #2
    1. Advertising

  3. "Jordan S." <> wrote in message
    news:...
    > Thanks Juan, your patience is appreciated.
    > I think I am confused. I am not understanding what is the relationship
    > between my VS project - and therefore assembly names - and the IIS Web
    > site. I have an old version of this application that I have put into
    > production for several clients. For each client, I have (1) created an
    > identical NTFS strucutre (with domain name as folder name being the only
    > way some of the folders differ); (2) created the Web site in IIS; and (3)
    > copied the underlying SQL Server database. For each different Web site
    > (IIS 6 on Windows Server 2003), I have simply copied the application's
    > dll/aspx/ascx/etc files and everything "just works". Now I have undertaken
    > a complete rewrite of that legacy asp.net 1.1 app - this time in 3.5 with
    > lots of updates and many components broken out into their own dlls. IN any
    > case I am confused as to why I can't do what I thought I had done with the
    > older version - and why things didn't work with my development machine
    > when I went to create a 2nd Web site - *outside* of Visual Studio
    > altogether. I do not understand what compiling again or in a new project
    > or from the command line would do for me. Is there some meta data that
    > goes into the output assembly manifest? That would make sense, but I don't
    > know how that relates to my problem. I would sure appreciate a bit more of
    > an explanation. Were you thinking that I was trying to create a
    > new/separate VS project using the first one as a starting point?


    Jordan, have you tried right-clicking the project and using Publish?
    --
    John Saunders | MVP - Connected System Developer
     
    John Saunders, Oct 6, 2008
    #3
  4. re:
    !> Were you thinking that I was trying to create a new/separate
    !> VS project using the first one as a starting point?

    Not a new/separate VS project, but a copy of your first VS project.

    If you want to have a distributable copy of your VS project,
    select "Publish <ProjectName>" from the "Build" menu item in the VS 2008 IDE.

    That will allow you to create a directory which will serve as the
    repository for the compiled/source files you need to distribute.

    You can copy *those* files to any IIS server which has the corresponding
    version of the .Net Framework, and use any virtual directory/application name
    you choose, as long as the virtual directory/application is configured to use
    the .Net framework targeted.




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Jordan S." <> wrote in message news:...
    > Thanks Juan, your patience is appreciated.


    > I think I am confused. I am not understanding what is the relationship between my VS project - and therefore assembly
    > names - and the IIS Web site. I have an old version of this application that I have put into production for several
    > clients. For each client, I have (1) created an identical NTFS strucutre (with domain name as folder name being the
    > only way some of the folders differ); (2) created the Web site in IIS; and (3) copied the underlying SQL Server
    > database. For each different Web site (IIS 6 on Windows Server 2003), I have simply copied the application's
    > dll/aspx/ascx/etc files and everything "just works". Now I have undertaken a complete rewrite of that legacy asp.net
    > 1.1 app - this time in 3.5 with lots of updates and many components broken out into their own dlls. IN any case I am
    > confused as to why I can't do what I thought I had done with the older version - and why things didn't work with my
    > development machine when I went to create a 2nd Web site - *outside* of Visual Studio altogether. I do not understand
    > what compiling again or in a new project or from the command line would do for me. Is there some meta data that goes
    > into the output assembly manifest? That would make sense, but I don't know how that relates to my problem. I would
    > sure appreciate a bit more of an explanation. Were you thinking that I was trying to create a new/separate VS project
    > using the first one as a starting point?
    >
    >
    >
    >
    > "Juan T. Llibre" <> wrote in message news:ue%...
    >> re:
    >> !> I was hoping that my Web site (#2) would not need to
    >> !> have the same name or folder structure as my VS project.
    >>
    >> Your website doesn't need to have the same name. Your VS project must.
    >>
    >> re:
    >> !> if that's my only or best option.
    >>
    >> You can also compile the assemblies manually from the command-line,
    >> using either msbuild or the language compiler your application uses.
    >>
    >> I am curious about this that you wrote:
    >>
    >> !> 3. Set the NTFS permissions to be the same as those for the same project
    >> !> as created under Visual Studio - including for the ASP.NET account.
    >>
    >> As you may, or may not, know, the accounts ASP.NET runs as are different
    >> for the ASP.NET Web Development Server embedded into VS 2008...and IIS.
    >>
    >> The ASP.NET Dev Server runs as the Administrator account in VS 2008.
    >> When running ASP.NET in IIS 5.1/XP, the account ASP.NET uses is the ASPNET (no dot) account.
    >>
    >> That may also affect your database functionality, since the account name passed to
    >> your SQL Server database, if you're not using ad-hoc authentication, will be different in each case.
    >>
    >> To which account did you grant read/write permissions to ?
    >>
    >> If you're not sure which account ASP.NET is running as, run this script I wrote :
    >>
    >> identity.aspx :
    >> ---------------------
    >> <%@ Page Language="VB" %>
    >> <%@ Import NameSpace = System.Security.Principal %>
    >> <script runat="server">
    >> Sub Page_Load()
    >> Dim tmp As String = WindowsIdentity.GetCurrent.Name()
    >> Label1.Text = "ASP.NET is running as the account : " & tmp
    >> End Sub
    >> </script>
    >> <html>
    >> <head>
    >> <title>What account is ASP.NET running as ?</title>
    >> </head>
    >> <body>
    >> <form id="form1" runat="server">
    >> <div>
    >> <asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
    >> </div>
    >> </form>
    >> </body>
    >> </html>
    >> -----------
    >>
    >> Running that script will tell you which account ASP.NET is running as.
    >> *That* will be the account which needs NTFS permissions.
    >>
    >> You may want to run the script in both environments ( VS 2008 and IIS ),
    >> so that you can check that there's a different result for each.
    >>
    >>
    >>
    >>
    >> Juan T. Llibre, asp.net MVP
    >> asp.net faq : http://asp.net.do/faq/
    >> foros de asp.net, en español : http://asp.net.do/foros/
    >> ======================================
    >> "Jordan S." <> wrote in message news:...
    >>> Thanks Juan,
    >>> I can certainly do as you suggest, and will gladly do so if that's my only or best option.
    >>>
    >>> I was hoping that my Web site (#2) would not need to have the same name or folder structure as my VS project. I plan
    >>> to copy this ASP.NET Web application for use by multiple customers. Is there any way I can tell ASP.NET to use the
    >>> dll files from App #1 in the /bin directory of App #2 even though the name doesn't match? Perhaps I'm totally
    >>> missing some important point here. If so, where can I read up on this naming convention? (I'm not sure what terms to
    >>> search google on for this).
    >>>
    >>> Thanks again.

    >>
    >>
    >>
    >>> "Juan T. Llibre" <> wrote in message news:%...
    >>>> re:
    >>>> !> 2. Copied all of the site's dll and ascx files into the folder structure,
    >>>> !> with all of the dlls going into the bin folder, as in the VS project's folder structure.
    >>>>
    >>>> You can't do that.
    >>>>
    >>>> Dll's in the bin directory have a naming convention based on the Application's name.
    >>>> That's why you're getting the error.
    >>>>
    >>>> Your second application is trying to find application2.dll in its /bin directory,
    >>>> but only finds application1.dll in its /bin directory.
    >>>>
    >>>> To solve this, *don't* copy the dlls for the 1st app into the 2nd app's /bin directory.
    >>>>
    >>>> Create a new VS 2008 blank project, add your aspx/ascx/config/asax files and compile the new project.
    >>>> VS will automatically create the bin dlls with the correct name.
    >>>>
    >>>> *Now*, you can copy all of the site's dll and ascx files into the virtual folder structure.
    >>>>
    >>>>
    >>>>
    >>>>
    >>>> Juan T. Llibre, asp.net MVP
    >>>> asp.net faq : http://asp.net.do/faq/
    >>>> foros de asp.net, en español : http://asp.net.do/foros/
    >>>> ======================================
    >>>> "Jordan S." <> wrote in message news:...
    >>>>> On my XP Pro dev box I have created an ASP.NET Web application using Visual Studio 2008 pro. It works great. I
    >>>>> then went to manually create a copy of the Web site, with a different name, on the same machine. I did the
    >>>>> following, and the Web site fails to start with a 403 error, or a 404, depending on the particular resource
    >>>>> requested.
    >>>>>
    >>>>> Here are the steps I have performed:
    >>>>> 1. Created a new NTFS folder structure, with a \bin folder under the site's root folder.
    >>>>>
    >>>>> 2. Copied all of the site's dll and ascx files into the folder structure, with all of the dlls going into the bin
    >>>>> folder, as in the VS project's folder structure.
    >>>>> (note: there are zero aspx files in this site, as all pages requests are served via custom http handler factory)
    >>>>>
    >>>>> 3. Set the NTFS permissions to be the same as those for the same project as created under Visual Studio -
    >>>>> including for the ASP.NET account.
    >>>>>
    >>>>> 4. Manually created the Web site (web application virtual directory) in IIS (mmc snap-in), being careful to keep
    >>>>> the permissions and capabilities the same as those for the Web application virtual directory that Visual Studio
    >>>>> had created for the original project.
    >>>>>
    >>>>> 5. Ran aspnet_regiis -s on the new Web site... it ran to completion normally (no error messages when it ran).
    >>>>>
    >>>>> 6. Restarted IIS (via MMC snap-in).
    >>>>>
    >>>>> After all of the above, the site fails to start. In Global.Init, I write to an Application event log... writing a
    >>>>> brief message stating that the Web site started. No such message appears in the event log. In my custom override
    >>>>> of Global.Init, I also have good exception handling that writes a warning or error message to the event log. No
    >>>>> such messsage appears. Also, during my custom override of Global.Init, I have logic that connects to and queries a
    >>>>> local SQL Server database. As I monitor DB activity, the database receives no attempts to connect from this
    >>>>> particular ASP.NET Web application.
    >>>>>
    >>>>> So it's as if this thing isn't starting at all - at least not my custom logic. If I create a really simple
    >>>>> default.aspx file (with static html only and no code-behind), then that is served to the browser just fine. But
    >>>>> even in these cases, nothing else works (as described above... no messages written to the event log, so I know my
    >>>>> custom Global.Init isn't running.
    >>>>>
    >>>>> What could I be missing? What to do now? Thanks!
    >>>>>
    >>>>>>
    >>>
    >>>
    >>>

    >>
    >>
    >>

    >
    >
    >
     
    Juan T. Llibre, Oct 6, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter
    Replies:
    1
    Views:
    10,097
    Steve C. Orr [MVP, MCSD]
    Nov 9, 2004
  2. Nathan Sokalski
    Replies:
    4
    Views:
    622
    PJ on Development
    Nov 8, 2007
  3. David

    manually created template column databind

    David, Jan 22, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    157
    David
    Jan 22, 2005
  4. mitch
    Replies:
    0
    Views:
    182
    mitch
    Mar 4, 2004
  5. Nathan Sokalski
    Replies:
    4
    Views:
    211
    PJ on Development
    Nov 8, 2007
Loading...

Share This Page