Server application unavailable in a MVC2 application over IIS 6 - asp.net-mvc

I created an application pool, and i assigned to it a test application(simple 1 view that renders hello, one action and one controller ) that i made in MVC
The thing is that when i executes as many times as i want it works, but after some hours (i dont know why), if i enter again into my server and i execute it, crashes.
The thing is that the only user that executes this application is me. Im wondering the following:
Are in IIS 6 any default setting that says something like: "Pool, shutdown if there arent request during certain amount of time"?
Thanks in advance.
Best regards.

I found the problem.
In the application pool there wasn't only one application, there were two.
The first one, configured to run on asp.net 2.0, and the other (my test application configured to run on Asp.net 4.0). Every time I reset the pool and execute one application, the other crashes.
The solution: All the applications running on the same application pool should be configured to run in the same version of asp.net

Related

MVC and EF randomly cause exceptions

I have a web application running on a deployment server that uses MVC5 and EF6. I have the same version concurrently running on my development machine. I can make updates or add functionality and test it on the development machine and have no problems, then publish it to the deployment server and it will work fine.
From 2-8 days all of a sudden the system starts giving me entity validation errors, or giving me an error about changing an entities Id in a simple page that does nothing but load some entities and iterates through the list to display them.
To fix the problem I literally do nothing other than go back in to VS2013 and click publish...I don't change any code or settings...and it works again.
Anyone else have this problem or know what could be the cause? Its not a complex web app and there are no background processes running.

IIS 8 Publish - eliminate hang time when application gets updated

What are the best practises to limit (or best, eliminate) hang time when publishing changes to a single-server IIS 8 ASP.NET MVC application?
Now, we are deploying our changes via MSBuild.exe trough TeamCity. Once the app is deployed, it hangs for a little less than a minute doing its startup things (building NHibernate proxy assemblies, changing db schema, building ioc container etc.).
Is there a way for us to setup that the "old" process keeps handling requests until the new one is fully ready (and not just deployed) ?
EDIT:
Our startup code is launched via the
[assembly: WebActivator.PreApplicationStartMethod(typeof(..), "..")]
attribute.
You didn't specify what version of IIS you are using, but if you are using version 8.0 then you might want to take a look at the Application Initialization feature: http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-application-initialization
You'll want to set your application pool start mode to AlwaysRunning and then set preloadEnabled to true. Setting preloadEnabled to true tells IIS 8.0 to send a "fake" request to your application when the associated application pool starts up, whilst this won't eliminate the startup compilation, it will mean your application is available sooner than it was previously. You can also set IIS to display an alternative page whilst compilation is occurring, if you don't want your users hanging on...

MVC3 Application in Azure Cloud Service seems to be recyling too often with long initial waits

I have a Windows Azure Cloud Service which is running:
MVC3, C#, EF4.1, Razor
on
Windows 2012 R2 with .NET4.5 in WACS(osFamily="4")
I am finding that if I leave the application for a little while, say 10-15 minutes, the initial duration of the process is very long, can be about 2 mins. I assume this is due to the assemblies dropping out of memory, and the IL code needing to be recompiled. I suspect this is also tied into the application pool recycling too often.
First off, is it possible to precompile my MVC3 application and then deploy to WACS so if the assembly is dropped/recycled then it will load again very quickly. If so, how? I may well have missed something very obvious.
I guess I can also alter the setting on the app pool within the WACS IIS manager?
Thanks in advance.
EDIT:
I have found : /p:PrecompileBeforePublish=true , but not sure how to use it in conjunction with the VS2012 Azure publish action.
Check http://blog.smarx.com/posts/controlling-application-pool-idle-timeouts-in-windows-azure for how to set the IIS idle timeout to never.
Essentially, you want to create a startup task that does:
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00

Webservice call fails if I dont switch asp.net version back and forth under IIS

I have the strangest problem.
I've deployed a asp.net mvc webapplication (virtual directory under IIS 6 running under a application pool shared by other net 4.0 applications. In the webapplication I have an assembly that calls the MS Reporting Services webservice. The strange part is, if I dont use the webbapplication for a while and then go into my website so that the call is made to the webservice I get the following exception:
"HTTP status 503: Service Unavailable"
First I thought this had something to do with the service really beeing unavailable but after trying everything from different machines (and console applications) this was not the case.
To make a looong error search short: I opened up the properties window for the virtual directory selected the ASP.NET tab, changed the value in the dropdownbox to 2.0.. and without clicking apply or ok, change the value back to 4.0 and then clicked "Apply" and then "OK", and voila the service call worked again.
After this procedure is done I've noticed the following log in windows eventlog:
"Restarting W3SVC" with source "ASP.NET 2.0.50727.0". Why is that, I've only choosen the 2.0 framework, and then switched back to 4.0 before hitting the apply button. The asp.net version should still be 4.0 and if any service is restared the source of that event should be 4.0.
If I wait for a while the problem occurs again and I have to do the same procedure again.
Does any one have any idea as to why this happens?
Update: The problem was found to be the result of problems doing a DNS lookup. I know it sounds strange but it's true. If we use the ipadress when calling the webservice the problem was solved...
/Best regards Vinblad
Is your application pool being reset? What's its time out I think its about 20 mins by default. By changing the .net version you are recylcing the application pool making it restart.

Application pool reset breaks ASP site

I am seeing a weird behavior on IIS7 on Windows 2008. I have an ASP MVC application installed and fully functioning. Every time i reset its application pool, the website stops working and displays a 404 error.
The only workaround I found for this is:
1. Rename default.aspx, global.aspx, and web.config to something else
2. Create a simple index.htm file and place it in the root
3. Browse to the site (which correctly displays index.htm)
4. Rename the three files back
At that point the site will load properly and work as expected. Anyone has any idea why that would happen?
Thanks!
Check out the Windows Event Viewer, under Application. The website might be throwing an exception each time it attempts to restart.

Resources