Publish (Deploying) my website - asp.net

I am publish my website application . I am storing all my data in XML files in App_Data folder and in some other folder too.
The steps i follow are
1) Publish using visual studio 2010 asp.net c#.
2) Then copy my all file from "\Debug\PackageTemp" and paste in "C:\inetpub\wwwroot"
The files in wwwroot are being used my inetmgr and my system now acts as a server.
Am i doing it right ?
One More Question .
If i publish and follow the steps as mentioned above ,then for second time all my data (in XML file)get reseted.
So i wrote a batch file which will keep all my data files in backup and after deploy my website i vl copy my backup files in respectively folder ..but i dont know when to call my batch file .Is there anyway to call these batch file while i am doing my deployment ..
OR
there is any feature provided by microsoft visual studio to keep backup and automatically copy these files or not to modify some files

Once you Publish your solution, try selecting the Publish Method as "File System". Then point the target location to any folder on your system/network and click on the Publish button in the dialog.
Just copy all those files and directories that are created in that location, to either your FTP folder in case of a Web Deployment or to a local/network folder and configure a website from IIS.

Related

Deploying ASP.NET application to more than one live server using BAT file

Currently I'm deploying an ASP.NET application to 4 live servers that are load balanced manually by zipping and dropping the files to the servers. I would like to know how can I write a BAT file and run from a command prompt to install the application to all the 4 servers. Any help or reference would be appreciated.
Here are the steps if only files must to be updated (no the database)
Create a bat file and do that steps, after you have copy the updated files on some directory.
Make a file called app_offline.htm on your root of your web site, and the site will go offline.
Overwrite the new files over the site.
Rename or delete the app_offline.html file
Here is the command to make the copy copy all files and folders from one drive to another drive using DOS (command prompt)

What is SkipExtraFilesOnServer? Deployment azure. ASP.NET vNext

I need to skip a file on the server when I deploy my app. My friend told me that I could use SkipExtraFilesOnServer, but I don't understand how it works.
I have a .txt file that I want to keep unchanged after deploy.
When you publish your Web App using Visual Studio, in the Publish wizard under Settings, expand the "File Publish Options" and uncheck "Remove additional files at destination". If they are static data files your app depends on, then they should really be in the App_Data folder and you can make sure the "Exclude files from the App_Data folder" is checked.. The first option leaves any unrecognized files on the destination.
In the PublishProfile under YourProject >> Properties >> PublishProfiles, you will find a copy of yourPublishProfile.pubxml. The corresponding elements respectively in this file are:
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer> and <ExcludeApp_Data>True</ExcludeApp_Data>

Host the published site in nopcommerce

I am working in ecommerce website using NopCommerce2.2. I hosted the website by copying the complete source code in the wwwroot of the dotnet panel. It was working fine. But the size was huge. It was around 700MB. So I published the Nop.Web and its Administration. The site was working fine in the localhost(i.e local server) using IIS7. But when I copied the contents directly to the wwwroot in the global server,it was redirecting to the error page errorpage.htm?aspxerrorpath=/ instead of the site. Can anyone suggest a solution?
Copy your website (all folders and content) from your development computer to an application folder on your remote hosting computer (server).
Make sure the bin folder, on your remote hosting computer, contains the same dll files as on your development computer.
Copy Your Data
If your application contains data or a database. For instance an SQL Server Compact database (a .sdf file in App_Data folder), consider the following:
Do you want to publish your test data to the remote server?
Most likely not.
If you have test data on your development computer, it may overwrite production data on your remote hosting computer.
If you have to copy an SQL database (.sdf file), perhaps you should delete everything in the database, and then copy the empty .sdf file from your development computer to the server.
THAT'S IT. GOOD LUCK !
You need to follow the following steps as I mentioned
For Publishing the NopCommerce Application website below is the step:
Step : 1 - Publish the Nop.Web project.
Step : 2 - Publish the Nop.Admin project.
Go to the publish folder where your publish created
Step : 3 - Cut all dll from the Administration and Paste all dll to bin folder which in main bin folder for whole project.
Step : 4 - Copy two things from your source project and in App_Data folder Settings.txt and InstalledPlugins.txt which is not published in your publish file so paste this two files in your publish folder in App_Data. (You need to change the connection string in Setting.txt as per your database host).
Step : 5 - Now you need to copy whole plugins folder from your source folder (but remember this plugins folder you need to copy from the Presentation folder not from the main source where the solution file are there.).
Step : 6 - Now your publish have been ready.(now you can deploy on hosting server)

What is the purpose of Binaries\_PublishedWebsites directory under TFS build

TFS generates a publish directory under the build agent working directory:
Z:\TFSBuilds\1\box\CT\Binaries\\_PublishedWebsites
I am supposing that this is where TFS is automatically publishing the site. How can I use it for auto publishing of sites... as Should we refer our IIS website to this directory. What is the purpose of it?
Firstly, the working directory is as the name says, a "working" directory. That is where the build agent downloads the source, perform compiles etc. It also clears the working directory whenever you run the build again so you risk grabbing unfinished artifacts when you try to retrieve from the working directory.
TFS defines a "drop folder" that it will copy the final artifacts to, once the build completes. You can define the drop folder for a build by editing it's build definition:
Right click on the build and choose 'edit build definition.
Select the 'Build Defaults' section.
Tick 'This build copies output files to a drop folder'
Enter an UNC path for the build agent to copy artifacts to (make sure the Build Agent has access to that UNC path!)
Secondly, in regard to _PublishedWebsites. The build agent will create a _PublishedWebsites folder for each Web project it builds as part of its build artifacts (so if you tell it to build a solution with 2 web projects, it'll create [Project name A]\_PublishedWebsites and [Project Name B]\_PublishedWebsites). Inside each _PublishedWebsites folder are the contents to be dropped into an IIS application, same as what you would get by right clicking on a web project and selecting 'Publish'. I normally add a last step in the build workflow to copy the contents of this _PublishedWebsites folder to my desired IIS directory.
This link tells you how to add the copy workflow: TFS 2010: Copy _PublishedWebsites to test server
And here's more on drop folders: http://msdn.microsoft.com/en-us/library/bb778394.aspx

Web Deployment Project builds files that are no longer part of the project

This is the error I get:
Error 101 Could not load type
'control'. /Test.vbproj/x.ascx 1 1
WebDeployProject
This is a left over file that was part of the project last week, but one of the developers deleted it from the project. I have to manually delete the file in order to get the WDP to build. Is there a way to tell the WDP to ignore the files that are not part of the project or to see that these files are not part of the project and delete them?
You'll need to use your source control tools to find and remove local files that aren't under source control.
For instance, if you're using TFS, do the following:
Open Source Control Explorer (View -> Other Windows -> Source Control Explorer)
Right-click on the path in TFS that corresponds to your local working copy and select Compare
Use your TFS path as Source Path and your local working copy as Target Path
Under View Options, select "Show items that exist only in target path"
You've now got a list of all the files that exist in your local working copy but aren't in source control. For each file, either delete your local copy or add it to source control.
It could have something do to with the type of web project is it.
If it's a web site, then the compiler will attempt to compile every file in the folder. However, if it's a Web Application Project, then it will only compile those that you've specifically added as part of the project.
If you have recently deleted/removed a file from your project then you need go to Project > "Show all files" and all removed files will apear in your solution explorer. You can delete the file, /x.ascx and rebuild your WDP.
It has nothing to do with the type of Web project: http://amiraryani.wordpress.com/2008/11/06/web-deployment-project-aspparse-could-not-load-type/.
A Web Site itself considers files under its root directory as part of the site.
A Web Application Project itself allows you to customize build actions, etc. on a per-file basis.
A Web Deployment Project, however, will try to include files under the root directory (a la a Web Site), even if the WDP is associated with a WAP. That's why it doesn't matter which kind of Web project it is.
EDIT: To clarify, it would matter what type of Web project you are using if you were trying to Build, Debug, or Publish that project itself instead of using a WDP.

Resources