MVC and EF randomly cause exceptions - asp.net-mvc

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.

Related

MVC precompiled site "HTTP Error 403.14 - Forbidden" suddenly appeared after 11 months

I have a precompiled MVC site which runs successfully on multiple servers, and on multiple sites within each server.
One particular site a few days ago suddenly stopped working, returning
HTTP Error 403.14 - Forbidden
I couldn't find anything that would cause it, and rebuilt the site using the same source code as other sites on the same server, in a different folder, and the site ran fine for about 24 hours before once again suddenly experiencing the same error.
There is nothing in the Windows logs (Win 2K12 Server) or in the IIS (6.2) logs (other than confirming the 403). This particular site is running on a Virtual Server in Azure, but plenty of other sites are too, including on the same virtual server using the same source code and settings (other than domain name bindings).
I've currently moved the binding to a different process which is working fine, but I really need to get to the bottom of this in case it suddenly happens again.
I've googled this for days without success. Turning on directory browsing works, but of course not something I can or want to permanently do with MVC. Both home and MVC route requests return the same result, but calls for specific files (eg, a text file in a sub-folder) are successful. That certainly suggests a MVC-specific issue. But I can't work out how to specifically isolate the issue.
Obviously I've reset the application pool, the site itself, and indeed set up a new site using the same application pool (which is working currently, but I'm worried it too will suddenly break at the worst time).
Does anyone have any pointers for working out the main cause, please?

Published mvc app loading forever

I've published an MVC application on IIS 7.5 on external server. But when i run it it just says "Waiting for..." and nothing is happening! No errors, no application logs (because the application didn't even started), no IIS logs, no errors/warnings in event viewer. Can you tell me what can I do to track what is going on? Keep in mind that in development environment everything works fine. Also I already published the same application on another server and it is working like a charm.
the best you can do is to add glimpse to your project and see its reports,
btw, if you are using a shared host it could be a memory limitation, slow CPU, slow bandwidth,....a lot of possibilities....

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

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.

Server application unavailable in a MVC2 application over IIS 6

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

Resources