TFS VNext build Delete Files task need to exclude one file - tfs

I need to use the delete files task in a VNext build definition (TFS 2015).
asp.net c# web app on an IIS 7.5.
I found that we can use exclusion pattern, but it's not working.
How can I make this work?
Delete all files except app_offline.htm.
**;-:app_offline.htm
If it can't work like that, how can I make sure that the users will get the app_offline.htm file even when I'm deploying the application.
I first created a build to copy the app_offline page and another build to delete it. My problem is in the middle.
thanks

Leaving a site hosted in IIS online but showing a maintenance page is less than ideal. Since it's still processing the application's web.config, users will get intermittent errors during the deployment, depending on what files are currently changing and whether IIS is able to load the assemblies referenced in the web.config.
A better approach is to deploy a static maintenance page to a separate web site.
Then your deployment process can just be:
Stop real site
Start maintenance site
Deploy real site
Stop maintenance site
Start real site
Assuming the two sites have the same bindings, users will seamlessly be redirected to the maintenance site for the duration of the deployment.
Dealing with a site that's load balanced across multiple web servers is a slightly different scenario with additional options and considerations, but I'm assuming that's not the case here.

Related

How do you deploy a MVC4 .net app to production WITHOUT Web Deploy

I'm trying to deploy one of the default template apps that VS2012 generates for MVC4 to a production server (not on Azure).
It turns out that I'm not smart enough to figure out how to get Web Deploy working. After spending an hour on diagnosing different 404s, 403s, and 401s, I am ready to either ditch Web Deploy altogether, or start my project using PHP instead.
Can I just copy and paste my files and put them somewhere?
I'm fine with manually updating the database schema.
Anything else that needs to be updated?
You can publish directly to "File System" via "Publish" menu in VS (choose folder on production server). Then create WebApp on IIS with this folder (on the server) choose ApplicationPool 4.0 open port for your application if needed and start it.
What in the world makes you even think you need to use web deploy? You do realize that the web publishing wizard has several options to choose from, including FTP, file system, etc... I don't see how you could miss these.

Precompile during publish for Azure Web Services

We are using Azure Web Services (not Web-sites) and run ASP.Net MVC 5.1 application inside it.
When I publish web-sites through Web-deploy, I have an option to "Precompile during publishing":
When I publish to Azure Web Services, I can't find this option anywhere. Any pointers?
The idea is to pre-compile views, so first hit to a view would not be time-penalised by compiling on the fly.
I've looked on Razor Generator but it does not suit our needs. I've seen few other options, but compiling views at publishing stage makes the most sense for our case.
UPD:
Just for my reference, I've tried what David Ebbo suggested and it did not work.
Calling compiler %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler.exe -m /LM/W3SVC/1273337584/ROOT from command line on the Azure server seems to cause compilation. The Temporary ASP.Net root directory contains one directory this increases in-size and number of files contained within. The site then restarts after compilation. First page open performance then seems much better.
If I run this within a startup script it doesn't work as the site isn't avaible. I guess IIS hasn't started up. Looking at doing something like this Azure: How to execute a startup task delayed?
The site ID doesn't seem to change for different deployments. I guess could get the site id out of IIS and then use that it if it does.
So looks like that does it. Is there are more elegant way? Don't understand why compiling and deploying view files is such a chore.

Ensuring an acceptable online user experience while republishing to a live site

It's pretty much known that publishing to a remote location using VS2008 is a an exercise of great patience and faith.
As long as a 'publish' begins (using VS2008, publishing an MVC site), that site might be down from the first file that is successfully transferred. The problem being that unreliable internet access, or interesting error messages () can break the site, and require restarting.
It's understood that there is little to do from the VS2008 end. The question then:
What strategy can I use to ensure that there is an acceptable user experience during the 'downtime'? (e.g. "This site is currently under maintenance...")
A lovely feature of ASP.NET/IIS is that if you place a file named app_offline.htm in the root of the web application, all requests will redirect to that file. This would include requests for images, stylesheets, scripts, etc.. so you'll need to condense all media for the page into the page itself.
In fact, while Visual Studio is in the process of publishing your web application, it will place this file in the root of the application and remove it when the publish is complete. While Visual Studio doesn't allow you to customize the contents of its app_offline.htm, you can take the application offline yourself simply by uploading that page.

What is the proper way to deploy Orchard CMS to shared hosting?

I've created a basic website using the Orchard CMS, and attempted to deploy it to my shared host, Softsys, using Web Matrix (via FTP). Currently, the site technically "works", however it looks like all styling has been removed (even from the dashboard).
Is there a step or files that I missed while deploying the site? I know "Web Deploy" is probably the preferred method of deploying, but I'm pretty new to this, and was not sure what the login specifics were, or how to obtain them for web deploy.
Here is a screenshot of what the site currently looks like deployed:
Edit: it turns out that the problem was on my host's side, for some reason the virtual directory was not being created properly - I still am curious what the proper/best practice method to deploying is however.
It looks like you have no theme applied. Check whether you have your theme existing in ~/Themes folder and properly enabled in the admin Dashboard. Maybe the /Themes folder content hasn't been copied?
UPDATE
If your hosting provider allows the option to deploy sites via WebDeploy - that would be the best one.
The easiest and most straightforward way to deploy Orchard site is to:
Have the ASP.NET application properly configured in IIS and accessible. If you use hosting - provider does that for you. If you'd have a dedicated server - you have to set up an application yourself.
Grab the deployment package from Codeplex, or build one from the sources.
Copy the whole package to your site's root (via FTP or WebDeploy).
Run it and proceed with the setup.
Basically - these are the same steps as for every "ordinary" ASP.NET application.
You probably need to set IIS user to have write access to some of the folders: Themes, Media and App_Data.

How to publish an ASP.NET MVC website

I've a site that I'd like to publish to a co-located live server. I'm finding this simple task quite hard.
My problems begin with the Web Deploy tool (1.1) giving me a 401 Unauthorized as the adminstrator because port :8172 comes up in the errors and this port is blocked - but the documentation says "The default ListenURL is http://+:80/MsDeployAgentService"!
I'm loathe to open another port and I've little patience these days so I thought bu66er it, I'll create a Web Deploy package and import it into IIS on the server over RDP.
I notice first that Visual Studio doesn't use a dialog box to gather settings, or use my Publish profiles but seems to use a tab in the project properties, although I think these are ignored when importing the package anyway?
I'm now sitting in the import wizard with Application Path and Connection String. I've cleared the conn string as I think this is for some ASP stuff I don't use but when I enter nothing in the Application Path, the wizard barks at me saying that basically I'm a weirdo because most people publish to folders beneath the root site.
Now, I want my site to be site.com/Home/About and not site.com/subfolder/Home/About and I think being an MVC routed site that a subfolder will introduce other headaches. Should I go ahead and use the root?
Finally, I also want to publish a web service to www.site.com/services/soap which I think IIS can handle.
While typing this question, Amazon have delivered my IIS 7 Resource Kit, and I've been scouring the internet but actually I'm getting more confused.
Comment here seems to show consensus opinion that Publish isn't for production sites and that real men roll their own.
ASP.NET website 'Publish' vs Web Deployment Project
...I guess this was pre- Web Deployment Tool era?
I'm going to experiment on a spare box for now but any assistance is welcome.
Luke
UPDATE
The site was imported (to the root) manually with Web Deploy and it worked. If you get the error "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' " its because your app pool is 4.0 and should be 2.0.
If you are using VS 2010, may I recommend Scott Hanselman's Web Debloyment Made Awesome?
http://www.hanselman.com/blog/WebDeploymentMadeAwesomeIfYoureUsingXCopyYoureDoingItWrong.aspx
Even if you are using VS2008, there are nice concepts there that will probably help.
I've experienced the same frustration and trouble with this as well. Coming from a Java web background where we can package everything as a single WAR and toss it on the server, the deployment process with ASP.NET seems archaic.
I currently have a python script that uses FTP to transfer the needed files to my test instance on the remote server. I have another python script that transfers those files to my live site. These scripts are smart enough to take care of differences between some of the configuration files etc..
I've found it much easier than trying to setup permissions or using the Microsoft deploy tools.
Hi you can use filezilla software to upload

Resources