App_offline.htm created/deleted whenever I check out a file in TFS

∥☆過路亽.° 提交于 2019-11-27 01:19:51

问题


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...


回答1:


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.




回答2:


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.




回答3:


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?

Why does app_offline.htm keep appearing in my web project?




回答4:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!