locked
Visual Studio 2010 application deployment RRS feed

  • Question

  • There must be an easier way.  I have a simple application that works fine on the local server and want to complete the steps by deploying to a host.  The application is a menu that display all kinds of information and one page which involves a little database application.  In deploying, I need to find an easy way to change my web.config file to accommodate the sqlserver database application.  Its not that I am incapable of finding the right article to guide me, nor is it that I am lazy, but it just cannot be that difficult!  I have complied with the following stated requirements as a precursor to this: 

    o   Acquired an add-on from my provider to allow functioning with sql_server express.

    o   Acquired database space from my provider.

    o    Moved all files to my provider environment.

    o   Converted my MDB file with the help of sqlserver Management Studio to  SQLSERVER 2008R2 format (a task that required me about a month including great assistance from a Forum MVP).

    I started to follow the simple instructions provided in a 12 part treatise on how to deploy.  I estimate that it will take me another month just to read this, and I don't know how much longer to get results I can use.  Is there a reader out there who can point out the changes to my web.config file (from my local computer) or point out to me why it is not as simple as I think it is? This application is not an end-all-be-all task, it is just a learning tool that I will embellish as I need to.  The code is pasted below.

     

    <?xml version="1.0"?>

    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->

    <configuration>
      <connectionStrings>
        <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
          providerName="System.Data.SqlClient" />
        <add name="JulieDVDConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=&quot;C:\Users\NEWADMIN\Documents\Visual Studio 2010\WebSites\WebSite34\App_Data\JulieDVD.mdf&quot;;Integrated Security=True;Connect Timeout=30;User Instance=True"
          providerName="System.Data.SqlClient" />
      </connectionStrings>

      <system.web>
        <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />

        <authentication mode="Forms">
          <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
        </authentication>

        <membership>
          <providers>
            <clear/>
            <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
                 enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
                 maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
                 applicationName="/" />
          </providers>
        </membership>

        <profile>
          <providers>
            <clear/>
            <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
          </providers>
        </profile>

        <roleManager enabled="false">
          <providers>
            <clear/>
            <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
            <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
          </providers>
        </roleManager>

      </system.web>

      <system.webServer>
         <modules runAllManagedModulesForAllRequests="true"/>
      </system.webServer>
    </configuration>


    eps123

    • Moved by Alexander Sun Wednesday, March 28, 2012 6:13 AM ASP.NET related (From:Installing and Registering Visual Studio Express Editions)
    Monday, March 26, 2012 7:52 PM

Answers

  • Hi eps123. You should just right-click the project name of your project in the Solution Explorer window and select "Publish website".

    Once done, a new folder called "Precompiled Web" will be created in your project folder. After that, you can copy out all the contents and paste it into your Inetpub folder where you will access the website later on. Please be reminded, you will need to go into IIS and setup a virtual directory to the path where you pasted your website so that it can be accessed later on.

    • Marked as answer by eps123 Thursday, March 29, 2012 7:01 PM
    Tuesday, March 27, 2012 6:06 AM
  • Thank you for convincing me that the publish option is the way to go.  I was slow to respond because  I was not sure that my profile was correct and slowly, I verified what it should be in terms of the service url.  Finally, when I tried "Publish" as you illustrated, the profile page kept coming back up, which is a weird way of telling you it didn't work.  I resorted to an option to create a deployment package which provided some output in the build window.  The output indicated that there is a problem on my own computer and I have been going back and forth with my provider.  I am pasting in the dialogue from my "create deployment window".

    _____________________________________________________________-

    ------ Build started: Project: WebApplication6, Configuration: publish Any CPU ------
      WebApplication6 -> C:\Users\NEWADMIN\Documents\Visual Studio 2010\WebSites\WebSite34 - Copy\bin\WebApplication6.dll
    ------ Publish started: Project: WebApplication6, Configuration: publish Any CPU ------
    Transformed Account\Web.config using Account\Web.publish.config into obj\publish\TransformWebConfig\transformed\Account\Web.config.
    Auto ConnectionString Transformed obj\publish\TransformWebConfig\transformed\Account\Web.config into obj\publish\CSAutoParameterize\transformed\Account\Web.config.
    Copying all files to temporary location below for package/publish:
    obj\publish\Package\PackageTmp.
    C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2330,5): Error : Web deployment task failed.(Object of type 'dbFullSql' and path 'Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\NEWADMIN\Documents\Visual Studio 2010\WebSites\WebSite34 - Copy\App_Data\aspnetdb.mdf;Integrated Security=True;User Instance=True' cannot be created.)

    Object of type 'dbFullSql' and path 'Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\NEWADMIN\Documents\Visual Studio 2010\WebSites\WebSite34 - Copy\App_Data\aspnetdb.mdf;Integrated Security=True;User Instance=True' cannot be created.
    Cannot connect to the database 'C:\Users\NEWADMIN\Documents\Visual Studio 2010\WebSites\WebSite34 - Copy\App_Data\aspnetdb.mdf'.
    One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files.  If this is an existing database, the file may be corrupted and should be restored from a backup.
    An attempt to attach an auto-named database for file C:\Users\NEWADMIN\Documents\Visual Studio 2010\WebSites\WebSite34 - Copy\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
    Updating dbFullSql (C:\Users\NEWADMIN\Documents\Visual Studio 2010\WebSites\WebSite34 - Copy\obj\publish\AutoScripts\JulieDVDConnectionString-Deployment_SchemaOnly.sql).
    Adding child sqlScript (MSDeploy.dbFullSql/dbFullSql[@path='C:\Users\NEWADMIN\Documents\Visual Studio 2010\WebSites\WebSite34 - Copy\obj\publish\AutoScripts\JulieDVDConnectionString-Deployment_SchemaOnly.sql']/sqlScript).
    ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
    ========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

    ______________________________________________________________________

    Finally, I am pasting in my discussion with my provider that expresses what I feel is going on.  I did not really get a response to that communication, but I would welcome your opinion of that.

    ____________________________________________________________________________

    Martin, I agree with you that the failure is at my local level.
      What I believe may be going on is a result of no one that is involved taking the time to
     look at what has happened before I began to try to publish.  
    Let me give you a summary:
    You (DISCASP) told me I needed a database in sqlserver 2008R2 format..  
    To do this I acquired sql server management studio and painfully learned that I needed only
     to back up my sqlserver express database and then restore it.  
    I did this naming the restored database a different name.
     I moved the newly named file to your server and Tony attached it on my behalf.  
    Keep in mind that my application continues to run fine with sqlserver express
    (untransformed database). One-click deployment does not know any of this and probably is
    trying to move the 2008 database as if it is 2008R2.  

    Do I make any sense?  From my own failure log building the deployment file, there is
    a reference to aspnetdb.mdf in my app_data folder. That file was not consciously created by
     me and I do not know how it plays into this.  I hope I am not confusing this further by
    relaying all of this, but tell me if I am wrong in my speculations.
    __________________________________________________________

    I am thankful for your taking the time to digest all of this.

    eps123


    eps123

    • Marked as answer by eps123 Thursday, April 5, 2012 4:20 PM
    Sunday, April 1, 2012 1:06 AM

All replies

  • Hi eps123. You should just right-click the project name of your project in the Solution Explorer window and select "Publish website".

    Once done, a new folder called "Precompiled Web" will be created in your project folder. After that, you can copy out all the contents and paste it into your Inetpub folder where you will access the website later on. Please be reminded, you will need to go into IIS and setup a virtual directory to the path where you pasted your website so that it can be accessed later on.

    • Marked as answer by eps123 Thursday, March 29, 2012 7:01 PM
    Tuesday, March 27, 2012 6:06 AM
  • Hi Eps123,

    Welcome to the MSDN forum.

    Nice to meet you again. Since your problem is related to ASP.NET Deployment, I am afraid that your thread is off topic here. Thus, for better support, I recommend you go to the ASP.NET Configuration and Deployment forum: http://forums.asp.net/26.aspx/1?Configuration+and+Deployment
    Sorry for any inconvenience.

    Best Regards,


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, March 28, 2012 6:12 AM
  • Thank you for your response.  I've spent a few hours trying to do as you say.  Nowhere in the application do I get the option to publish website.  Is there a difference between vs2010 and what you are referring to?  I am totally overwhelmed with all the one-click options that are provided and nothing thus far has resembled an actual deployment (or even an error in doing so).  I believe that the issues I have revolve around the sqlserver database deployment.  This has been my problem from go.  Without that little task, I do not require any of the clickand publish facilitators since I can ftp the necessary files to my provider. 

    eps123

    Thursday, March 29, 2012 7:15 PM
  • Hi eps123, please have a look at the screenshot below. As you can see, I right-clicked the project name, and there is a option to publish the website. Maybe you could share some screenshots of you screen and maybe we can further have a look at what is wrong if you don't mind? I was referring to VS 2008/2010 from my first post.

    Friday, March 30, 2012 5:00 AM
  • Thank you for convincing me that the publish option is the way to go.  I was slow to respond because  I was not sure that my profile was correct and slowly, I verified what it should be in terms of the service url.  Finally, when I tried "Publish" as you illustrated, the profile page kept coming back up, which is a weird way of telling you it didn't work.  I resorted to an option to create a deployment package which provided some output in the build window.  The output indicated that there is a problem on my own computer and I have been going back and forth with my provider.  I am pasting in the dialogue from my "create deployment window".

    _____________________________________________________________-

    ------ Build started: Project: WebApplication6, Configuration: publish Any CPU ------
      WebApplication6 -> C:\Users\NEWADMIN\Documents\Visual Studio 2010\WebSites\WebSite34 - Copy\bin\WebApplication6.dll
    ------ Publish started: Project: WebApplication6, Configuration: publish Any CPU ------
    Transformed Account\Web.config using Account\Web.publish.config into obj\publish\TransformWebConfig\transformed\Account\Web.config.
    Auto ConnectionString Transformed obj\publish\TransformWebConfig\transformed\Account\Web.config into obj\publish\CSAutoParameterize\transformed\Account\Web.config.
    Copying all files to temporary location below for package/publish:
    obj\publish\Package\PackageTmp.
    C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2330,5): Error : Web deployment task failed.(Object of type 'dbFullSql' and path 'Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\NEWADMIN\Documents\Visual Studio 2010\WebSites\WebSite34 - Copy\App_Data\aspnetdb.mdf;Integrated Security=True;User Instance=True' cannot be created.)

    Object of type 'dbFullSql' and path 'Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\NEWADMIN\Documents\Visual Studio 2010\WebSites\WebSite34 - Copy\App_Data\aspnetdb.mdf;Integrated Security=True;User Instance=True' cannot be created.
    Cannot connect to the database 'C:\Users\NEWADMIN\Documents\Visual Studio 2010\WebSites\WebSite34 - Copy\App_Data\aspnetdb.mdf'.
    One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files.  If this is an existing database, the file may be corrupted and should be restored from a backup.
    An attempt to attach an auto-named database for file C:\Users\NEWADMIN\Documents\Visual Studio 2010\WebSites\WebSite34 - Copy\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
    Updating dbFullSql (C:\Users\NEWADMIN\Documents\Visual Studio 2010\WebSites\WebSite34 - Copy\obj\publish\AutoScripts\JulieDVDConnectionString-Deployment_SchemaOnly.sql).
    Adding child sqlScript (MSDeploy.dbFullSql/dbFullSql[@path='C:\Users\NEWADMIN\Documents\Visual Studio 2010\WebSites\WebSite34 - Copy\obj\publish\AutoScripts\JulieDVDConnectionString-Deployment_SchemaOnly.sql']/sqlScript).
    ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
    ========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

    ______________________________________________________________________

    Finally, I am pasting in my discussion with my provider that expresses what I feel is going on.  I did not really get a response to that communication, but I would welcome your opinion of that.

    ____________________________________________________________________________

    Martin, I agree with you that the failure is at my local level.
      What I believe may be going on is a result of no one that is involved taking the time to
     look at what has happened before I began to try to publish.  
    Let me give you a summary:
    You (DISCASP) told me I needed a database in sqlserver 2008R2 format..  
    To do this I acquired sql server management studio and painfully learned that I needed only
     to back up my sqlserver express database and then restore it.  
    I did this naming the restored database a different name.
     I moved the newly named file to your server and Tony attached it on my behalf.  
    Keep in mind that my application continues to run fine with sqlserver express
    (untransformed database). One-click deployment does not know any of this and probably is
    trying to move the 2008 database as if it is 2008R2.  

    Do I make any sense?  From my own failure log building the deployment file, there is
    a reference to aspnetdb.mdf in my app_data folder. That file was not consciously created by
     me and I do not know how it plays into this.  I hope I am not confusing this further by
    relaying all of this, but tell me if I am wrong in my speculations.
    __________________________________________________________

    I am thankful for your taking the time to digest all of this.

    eps123


    eps123

    • Marked as answer by eps123 Thursday, April 5, 2012 4:20 PM
    Sunday, April 1, 2012 1:06 AM
  •  Answering myself.  I thought that posting all the details of what has transpired would be helpful toward getting a resolution.  I've come a long way toward this, still no cigar, but I'll continue to experiment.  At this point I consider this thread closed.


    eps123

    Thursday, April 5, 2012 4:24 PM