This application is currently offline - asp.net

I was working(learning) with Data bound controls in ASP.Net and suddenly got the error:
This application is currently offline. To enable the application, remove the app_offline.htm file from the application root directory.
I started searching it on google but ended up with no helpful solution. I was not able find app_offline.htm file also. And then I suddenly tried to open my project in browser again and it opened successfully and now its working. And now I have observed that in between as I am working on the project it shows this error in between (cant say when and on what criteria) and then after some time it starts working again. Can anybody help me why its happening?
I am using ASP.Net4.0 and Sql Server Express Edition.
EDIT
With somemore searching on google it seems that this gets created automatically in the solution. If we delete it the program works fine and even if you do not delete it gets deleted after sometime by itself. but will be created again after some time.
Its hard to post any code because there is no code that is giving error. But when I press (ctrl+F5) to open my project its giving error. Still for reference I created a webform Review.aspx based on a masterpage. I created a combobox and a gridview inside it. Here Combobox has some collection of numbers (GenreId) and when you select a GenreId it do Autopostback and Gridview shows the entry associated with the selected GenreId.
And then I tried to debug it in a browser, its giving error (for some time).

Here is the reason. have you try after closing all the design windows?
SQL Server 2005 express edition does not support multiple processes.
Only single process can access database at a time. So when a database
is accessed through visual studio, ASP.net runtime cannot access the
database. This will result into the internal server error. To prevent
this, VS 2005 places app_offline.htm file in the application's root
directory. The file contain above message. This causes ASP.net to put
the application in offline mode. Please note the accessing database
means opening any component of the database (I.e. table, view, stored
procedure etc.) into the design window. When design window is closed,
VS 2005 removes app_offline.htm file making the application in onliner
mode again.
http://www.codeproject.com/KB/aspnet/app_offline.aspx

Sometimes the ASP.Net DLLs aren't properly flushed from the cache, which can cause issues between builds. I would close visual studio (and make sure the web server the app is running on is stopped) and then delete any ASP.Net temporary files that are typically located in the C:\WINDOWS\Microsoft.NET\Framework[Version Number] for your application to help resolve the issue.

the app_offline.htm filename was introduced in ASP.NET 2.0 to make it much easier to show to visitors that the site's currently offline so that administrators could more easily upgrade the system or place a new version into production of the site. After removing that particular file the upgraded site's back available for people to see.
For more information take a look here: http://weblogs.asp.net/scottgu/archive/2006/04/09/App_5F00_Offline.htm-and-working-around-the-_2200_IE-Friendly-Errors_2200_-feature.aspx.
there is a file app_offline.htm on the root of your project.Remove it and build if you don't wanna see again

If you can not find the App_offline.htm file,
Go to the App_Data folder and there you will find the app_offline.htm file.
Right-click on the file and select Delete.
Good luck!

Related

Reasons for : xxx.aspx has not been pre-compiled and cannot be requested (it is pre-compiled)

hoping someone has some insight into this issue I get pretty commonly.
I have an ASPX Web Application that is pre-compiled. I have this application running within another IIS application working flawlessly. The parent application has an "updatable=false" property within the PreCompiledapp.config.
Now I need to add more pages to my application, which I create the same way in visual studio, and publish them with the rest of the application. When I open these files to check them in notepad, I can see the "This is a marker file generated by the precompilation tool, and should not be deleted!" as well as the .compiled file that generates with it.
On a local machine and application instance, this works... but when I copy the same applicaiton build to a client (same application, same pages, same everything) it gives me the " xxx.aspx has not been pre-compiled and cannot be requested " error.
What could be some causes of this? The pages are pre-compiled so I'm wondering if this can be thrown for something else. Any help is appreciated thanks!
I think the cause may be the parent application is set with updatable=false but the ASPX Web Application which you published is allow update. So it may lead to this problem. The same error message and the cause are described in detail here.
To solve this problem is convert your application to web application(has its own AppDomain and configuration) or publish the root application as updatable as well.

Changes to razor view not showing

I have made some changes to a view in my ASP.NET MVC3 application, but the changes I have made are not showing up when I test/debug the site within the browser. The changes I am making are simple text amendments to the markup.
I am using the Visual Studio development server for testing the application.
The odd thing is, I have tried publishing these changes to IIS and the changes I have made to the view are working when I test the application using the IIS server.
It is only when testing in the Visual Studio environment that this seems to happen.
Thanks,
A common problem i've run into is when you are not using IE and you close the debug session, but not your browser.
This means that the "IIS/development server" is still running in your system tray, but it is running on the old compiled code, if you hit ctrl + shift + b, you build your entire solution and re-publish your code to your development server. this allows you to hit refresh (F5) in your browser and the changes you've made to the razor view should now be reflected in your browser.
Are you using IE? Maybe deleting the cache or using another browser should work? I've had a lot of problems with that :D
Solution is to use IIS Express. For some reason, the VS development server doesn't recognise changes to code behind - nothing to do with caching on the browser.
However the location of the source code as suggested in other answers is important - it works for me using the c:\windows folder or c:\users\DefaultAppPool - apparently it has something to do with security to ensure.
Only applications running under the 'DefaultAppPool' identity are permitted under IIS. So, for anyone using a VM and mapping the host OS code folder you won't be able to rectify this unless you copy to a local folder in the c:\users\DefaultAppPool folder.
You may also now have difficulties accessing the SQL server database established for the Membership Provider under ASP.NET. For more details on how to fix that, I've posted on my blog.

Visual Studio Deletes Temporary ASP.NET Files during Build

I deal with a huge solution and a huge web project. Whenever I make a change to the Web project (not any of other library projects), refreshing the page would take sometimes 2 minutes or longer, with sometimes showing a Thread Abort Exception causing me to have to refresh the page again (so I can't even use this time to go to the bathroom or anything).
After some digging a coworker noticed that during our build some files in the Temporary ASP.NET Files folder were being deleted by Visual Studio, which is what caused our entire site to need to be rebuilt instead of just the single page I was working on.
He confirmed that this only happened when he build the Web project and only when there is at least one library project loaded as well.
After some digging of my own, I noticed that when I changed to using IIS Express in the Web Settings of the Web Project, the temporary asp.net files folder wasn't being cleared, as we don't really want to use IIS Express to test our code I then changed the radio button to "Custom Web Server" adding in the same domain name as we used in the "Local IIS Web server" option. (See below)
After I did this and rebuilt the project, I noticed that the Temporary ASP.NET files were still not being deleted, and when I then went to the site and refreshed the page, it only took around 8 seconds for the site to come up.

Change I make to code behind not updating when I publish my web application

I have an ASP.net that I built in VS2010 running in iis7 however when I go back into VS and make updates to the code behind file and re-publish the application still acts as it has before I made the changes. I have tried deleting and republishing all the files and restarting the app pool but it still doesn't affect how the application behaves.
project-->Property's--> Package / product web--> Items to deploy --> All files in this project folders
now publish your project.
your new files also added in publish folder. . .
DO NOT publish your vb and cs file on there server unless you feel like having your source code potentially exposed. There have been multiple vulnerabilities that have allowed code download.
Publish the application to a folder via the visual studio publish menu.
On the server, go into your temporary aspnet folder for example:
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
and find your app and delete it. If you cannot delete the files stop the worker process (w3wp.exe) or restart iis.
Republish and all should be good. If you are in doubt if that version is getting executed then add some logging in the new version or trace information.
There are two options for publishing an ASP.NET site to a server:
Copy the .aspx AND aspx.vb (or .aspx.cs) files to the server. The first user to hit the server causes compilation so it takes a little bit of extra time for them. Once that's done, subsequent hits should not be impacted.
Copy just the .aspx files - and a compiled DLL to the server. The DLL contains the compiled code so it doesn't exist on the webserver. The first user does not have to wait for compilation and the VB or C# source code is not on the server, potentially accessible to hackers.
It sounds like you've compiled the site to a DLL but that DLL isn't getting published to the server when you re-publish. Have you recompiled the site before publishing?
I faced similar issue with WPF single file exe publish.
while debugging from VS my changes were visible.
But when I pasted the exe to deployment folder, the changes weren't there.
I had to change the version number to see my changes when I run the exe from the deployment folder.
I may have to do with how single file exes are handled. The extracted cache may not be getting updated.

Asp.net - publishing a web site is causing an access denied error

I am working in visual studio 2008 sp1 and trying to publish a web site to a local directory. I keep getting the following error :
Error 3 Access to the path 'C:\Users\name\Documents\Sandbox\BTNET\App_Data\BTNET.mdf' is denied.
My question is how do I determine what user account Visual Studio is running as? I have tried to give everyone, guests, and IUSR_ full control and I am still getting this error. It’s painful..
You must "run as Administrator" VS2008 and publish site
Bring up task manager (ctrl+alt+delete) and look for devenv.exe.You should see the user in the User Name column.
AFAIK (As Far As I Know), it's ASPNET account
Since you're having problems accessing the DB file, make sure all the connection to that database are closed. That file might be in use, which in turn will cause the error.
It sounds like either an application is open and using the file(i.e. Visual Studio, modifying the schema or data or an instance of Access) or the user publishing the files does not have access to the delete files.
The first scenario is more common.

Resources