vs2010 publish fails: Unable to add 'app_ofline.htm' to the website - asp.net

I've created an online asp.net app using VS2010 with VB. It has been online and working for over a year. It's on our company's public web server but it's only for employee use. For as long as the site has been active and in use, I have had to made periodic changes to improve performance or to fix bugs; no problem until now. Suddenly, though, VS is throwing an error during the publishing process:
Unable to add 'app_offline.htm' to the Web site. The file 'app_offline.htm' already exists in this Web site.
The IDE is set up to create the site files in a local directory on my workstation machine, and then I copy the files to the server.
The local directory does not contain the app_offline.htm file, so I don't get why the error is saying that it already exists.
It appears that even with this error, all of the files are being properly created, and the site works fine after I copy them to the server, so this is apparently not a fatal error. But it's still unnerving to me to not know why it's doing that, and why just now when it has been fine for over a year.
I would either like to find what's causing the problem and fix it or to find a way to inhibit the process of creating the app_offline.htm file. Anyone have any ideas? No search has turned up any helpful information.
Thanks!

Have you tried removing the file in question from the project, publishing again, then adding it back and publishing?
You can right click on the file(s) and choose "Exclude from project..."

Related

ASP.NET MVC - Forbidden 403.14 on previously working site

I uninstalled the Visual Studio Tools for Git so I could reinstall a later version (it was doing strange things like leaving merge markers in files).
Since then, in a mixed ASP.NET WebForms and MVC 4 project, I can no longer visit MVC routed URLS. I get;
HTTP Error 403.14
Forbidden The Web server is configured to not list the contents of this directory.
I've also made some code changes, but I rolled back all these changes and the problem is still there. I then deployed to another environment and all is well.
I will report back with what I find. Pretty bad experience so far.
So I push all changes up and then cloned to a new folder. It works in the new folder!
I make a branch in the new folder and delete everything, copy-in the broken folder contents and see what Git thinks has changed, see what the difference is that breaks the site.
All sorts of differences found, all of them whitespace, CRLF issues with Git. I love Git.
I checkout a long previous version. That doesn't work.
I open a another MVC4 project, that works! So MVC and IISX 8 are able to serve pages, just not from this project (even from an old commit that was working).
This is serious problem. It worked for a moment and then not.
Update
So I clone again into another new folder. It works. Let's see how long this lasts.
Update
I check out my changes branch and it still works. The last time I broke it, it was after copying the broken contents in from the other repo folder, Git told me that the modifications were all whitespace.
So whitespace or Linux LF characters caused a 403 and ruined my Friday.

ASP.NET File Monitoring errors in Event Log

We are getting frequent errors in the Event Viewer, Application section. The source is ASP.NET 4.0.30319.0, category is File Monitoring. The Event ID is 1185. Text says "Failed to start monitoring changes to "file-path-here" because the network BIOS command limit has been reached." Then there is a reference to Microsoft knowledge base article 810886.
The question is: what process or service is doing this file monitoring, and why? We are not aware of how this is running or how it started. The monitoring seems to look at various folders on our web site, some are .NET folders, some are not.
We are looking for explanation of what is causing this monitoring; then we will try to address the errors.
When a asp.net starts to run a site, is monitoring one basic file (on the root of the web site), this is the app_offline.htm and if he finds it is stop the program showing only this file.
If find that other file change is recompile them if this is nessesary, but still showing the app_offline.htm if exist and not run the site.
Ones you remove the app_offline.htm the web pages starts run again, but asp.net still monitoring for this file - if exist or not.
So this is the monitoring of the asp.net you search for. Of course this is the default behaviour of asp.net. If you have install other software or something else have been on computer and fill it with monitoring, this is something different. I assume that you have too many web sites asp.net on the same server ? 500 or more ? if not then maybe you start searching for other software that make this monitoring of your files.
Analysis
How to find your self whats happends, download the Handle from sysinternals and run it, make the out on a text file like handle.exe >> result.txt and look the results.
http://technet.microsoft.com/en-us/sysinternals/bb896655
Look there if any suspicious program have open huge amount of files and what program is that. Monitoring files and directories are shown like
runningprogram.exe pid: 1352 ServerName\User
AC: File (RW-) D:\Monitor1
E8: File (RW-) D:\Monitor2
F8: File (RW-) D:\Monitor3
408: File (RWD) D:\InetPub\MySite
More
I check on my servers and found that a blog creation program have add a monitoring on every directory blog - I do not know why - but this is the way they have made it, to monitoring every blog for some reason, maybe you have something similar that creates a lot of file/directory monitoring for some reason.
The monitoring is being done by IIS (or the aspnet process with IIS6). It's watching for changes to files so that the site can be recompiled when needed.
You didn't mention your environment, but I used to run into this problem frequently when trying to run websites from Windows XP when the sites were located on a remote file share. I think the error comes up due to a limitation in CIFS (the network stack for file shares). Windows Server didn't seem to have the same limitations.
So, a few possible fixes:
Switch to Windows Server (or possibly Win 7)
Switch to a Web Application (doesn't allow recompiles)
Move your files from a remote share to a local drive

What is the difference between copying whole website to server and MSDeploy kind of tools

Maybe i'm totally outdated but for last four years i've been using simple FTP upload feature while uploading new website even without building it within Visual Studio. Just bunch of ASPX and CS files as in Visual Studio.
I do understand that compiling the project will provide me with some security defence so ones who have access to the server won't be able to read those files in text editors and i will avoid first time compilation but is that so important?
I mean, you can always do a lot of harm if you have access to server that just reading CS files instead of DLL.
First time compilation usually takes no more than 1 minute just searching for compiled version of the site will take as much time.
Now i'm watching video on PluralSight which explains new MSDeploy tool available from ASP.NET and i can't see any good reason to use it.
So what's wrong with the old fashioned way of just sending files via FTP without compiling or using fancy tools?
I did speed test and with MSDeploy i can deploy a website twice faster than old-fashioned FTPing. So instead of 4 minutes it will take 2.
Now from another perspective, when i already have alive project on the web. In which have to change Default.aspx because i have typo in some html tag. Deployment via MSDeploy will take 10 times more than uploading one file
Maybe i miss something?
MSDeploy does things which FTPing to a site can't do. Need to change a machine.config? You're unlikely to have FTP write access to the folder which contains it. Want to change a server setting in a server-version-independent manner? FTP won't do that. Etc. FTP works fine for copying files to folders in which you have write access, but that's all it can do.
When you deploy a project you can do a lot of things with it.
You can set up a job in your deploy that packages all your javascript into one file and all your css into one file.
You can set up a job in your deployment that changes a bunch of config settings to match your production server settings (rather then development settings).
The idea of deployment is that you take your current development website and transform it into a production website without having to do any of that manually.
The most important thing is that when you can only deploy your website you will never forget to package your js or forget to remove some debugging code because you can't just sneakly update a single file.

Do not upload specific files when publishing website with VS 2008

I use the "publish website" option to directly publish my ASP.NET - website to my ftp-server. This works quite nice.
The problem is the biggest part of my project are DLL-Files in the bin-directory which are external libraries that I only update quite rare.
So I do not want then to be uploaded every time. With my local resources I can select whether these files should be uploaded every time, never or only when changed, but I do not find this options for files in the bin-directory.
Any way to solve this?

Publishing Web App Project with Visual Studio

I am using Visual Studio 2008 and trying to publish a Web Application Project, but it keeps failing when trying to add files in the project. Below is a sample of the message;
Publishing folder JavaScript... Unable
to add 'JavaScript/hoverIntent.js' to
the Web site. Unable to add file
'JavaScript\hoverIntent.js'. The
specified file could not be encrypted.
This happens for image files too. I am lost as to why it is happening. I should add that I am using Windows 7 build 7100, not sure if this is casuing the issue??
Any help greatly appreciated
I know this is an old topic, but I found it when I googled for the same problem.
My solution was to remove the "Encrypt" flag from Windows Explorer for the files listed (Right click -> Properties -> Advanced)
This blog post at BlackMarble is suggesting that you may have the target directory set to use encryption. Sounds like the exception you're seeing is the inability for the VS publish process to handle that.
To get around this problem:
use VS to publish to an intermediate directory. Somewhere on your PC perhaps.
copy the files yourself (with a batch file maybe) to the server
That's a workaround, at least.
Disable windows encrypted file system in cmd with the following:
fsutil behavior set disableencryption 1
Then restart your PC.
When I had this problem on publishing a Visual Studio 2010 web project either to a local folder or to a host, I was stumped. Visual Studio didn't indicate which files or even folders had caused the problem. I wasn't aware there were any encrypted files in the solution and I couldn't find any. I was unable to update my website.
I googled how to find encrypted files but none of the solutions involving efsinfo.exe were appropriate to Windows 7 then I found an example using the cipher command:
https://superuser.com/questions/58878/how-to-list-encrypted-files-in-windows-7
There were a number of different answers to finding the encrypted files. I used the command prompt method.
I opened a command prompt in the root of my application and did:
D:\Data\Code2011>cipher /s:MyWeb >Encryption.txt
I then did a case sensitive search in Encryption.txt for lines beginning E[space] or 'the file is encrypted'
I found two .htc files which were encrypted in a styles subfolder and was able to unencrypt them in the advanced tab of explorer file properties.
The Web then compiled and published OK.
I had this issue as well. I set the source files properties to not be encrypted but that still wasn't working. Turned out that the files were cached in the temporary deployment folder and I had to uncheck encryption there as well. It probably would have worked to delete the temporary deployment directory but the other way worked.

Resources