I have an AJAX-heavy ASP.NET web application developed using .NET 4.0, using TFS as our source control. We recently upgraded our dev tools to use VS2010 and TFS 2010 exclusively, but now every time a file is checked out, we see visual studio reloading all the symbols, and all the sessions being dropped.
After putting some error logging code, we discovered the reason for the recycle is it reckons App_offline.htm is changing whenever we check out. This doesn't exist anywhere in the project, and my SO-fu has found some information about SQL Express making this file get created and deleted, so it's possible that's what's happening here.
It looks like I do have SQL-Express installed, but even disabling the services that are running, the problem persists.
Is there any way to stop a check out from adding/removing this file, if this is indeed what is happening? It's beyond frustrating to have the app recycle whenever I simply check out a file...
I have discovered a work-around.
1) Go to the location in which Visual Studio caches the app_offline.htm file C:\Users[user]\AppData\Roaming\Microsoft\VisualStudio\11.0\ (replace [user] with your username)
2) Delete the app_offline.htm file
(NOTE: this alone will not solve it, as VS regenerates the file again when it's not found)
3) Create a directory called app_offline.htm (a DIRECTORY!)
This essentially causes an error with the process that attempts to use the file because it's not a file and the name clash means VS cannot try to recreate the file. Luckily the error has no unwanted side-effects.
Now continue with using VS and Team Foundation Server and enjoy not constantly having the appdomain reloaded!
This does of course means that any Publish process will probably not use the app_offline.htm file, so you'll need to keep an eye on that.
Since I have the problem as well I decided to try and track it down. First I figured out that if my database connections are offline and I click the Refresh button in the Server Explorer, it creates the app_offline file in the root of my website, and then deletes it. I re-produced it several times.
I actually have 3 database connections in the server explorer. If I disconnect the 2 connections that are actually connections to a database on a remote SQL server, it does not produce the app_offline file when I refresh. It ONLY produces the app_offline file if I disconnect from a LOCAL .MDF file, and then refresh (which re-connects to that .mdf file and the red disconnected X goes away). Sure enough, after every re-connect to that local database, the app_offline.htm file shows up in my Recycle Bin.
Taking it a step further, I detached the local database (.mdf file) and moved the file to my desktop. Then re-started VS2010 and could no re-produce the error. I put the files back, re-established the connection, and started getting the app_offline again. Then I disabled the SQLExpress service, and did get some other errors, but even with the SQLExpress service disabled, I still got the app_offline in my Recycle Bin.
So, I guess my answer is to get rid of .mdf local databases if you can. It's not a good option for me because I need that local database when I'm working on code remotely, but if you don't need any local databases, maybe you could try removing them.
Note: I'm using VS2010 (and sometimes VS2008) and SQLExpress 2008 RS. I do not use TFS.
Seems like the answer is to use Web Application projects, not Web Site projects.
stopping app_offline.htm from being created and deleted at each build?
Maybe, someone do checkin in the file app_offline, when you get the project, the file comes. Look at your source repository.
来源:https://stackoverflow.com/questions/3965346/app-offline-htm-created-deleted-whenever-i-check-out-a-file-in-tfs