ASP.NET MVC Site sometimes showing page source - asp.net

We have a website running ASP.NET MVC 4 which would occasionally show the HTML page source when loaded, instead of the output generated by the view + controller. Restarting the associated Application Pool fixes this until it randomly happens again.
The web server is an AWS EC2 instance running on Windows 2012. Trying to Google this turned out to be in vain. Has anyone experienced this and knows what's the cause and how to fix this?
Thanks.

Related

ASP.NET Web Api application not running when deployed to IIS 8

I have created and Angular / ASP.NET application that work perfectly in VS using IIS Express. When I deploy it to IIS 8 on Server 2012R2 it does not work.
The Dot Net Framework 4.5 and ASP.NET 4.5 frameworks are installed per the many tutorials that I have found.
The setting: "runAllManagedModulesForAllRequests" is set true.
My default page 'index.html' is a single page Angular application that does load and execute correctly when I access the application url. The IIS server is serving up all of the requests without a problem. Except for routed Web Api requests. They all return 404.
I also put in some functionality for write to a file in the Application_Start method of Global.asax. The file is NOT being written. This tells me that ASP.NET code is not running at all.
I cannot find anything relevant in the Event viewer. The IIS log simply is telling me about the 404 error. Same as I am seeing in the network tab of developer tools.
I have searched the net generally, and stackoverflow specifically with no success.
What might I be missing? How do I go about troubleshooting this?
Thanks

ASPX Page Not Found (Error 404), though it exists?

I have a C#.NET project and am having a problem with a single web forms, ASPX page when debugging my application. Most of my application works fine, but when I hit a particular page, I get an Error 404, resource not found. I don't understand this because the file does exist, and it exists in the path that is being referenced. And, I hit several other ASPX pages on the way to this one, without error.
Now, I should mention that this particular page was only recently added to the project. My coworker, who added the page, says he was able to get the page to work, but we have different environments. So, I'm sure that has something to do with it, but I don't know what. Below are the known details regarding the differences between our environments.
My environment
Windows 8.1
IIS Express
Visual Studio 2013
Co-workers environment
Windows 7
IIS 7
Visual Studio 2012
We are both running with the same source code, as well as the same site and application pool settings in IIS, which are pointed to run time 4.0 and in classic mode.
Does anyone here have any idea why this would happen, or what I might try to get past this?
I ended up fixing this by switching to local iis and enabling the Static Content option in Windows Features.

Page never loads

I have an ASP.NET MVC 4 application. When I run it and try to access it using a web browser, the browser never loads the page; it is left stuck in the loading state.
I've tried pausing the debugger, but it doesn't show any threads stopped in the application code:
It was working fine when the application was first created from the Visual Studio template. I'm not sure which aspects of the application are relevant to this. It's running Elmah for error logging, and it's running under the Visual Studio development web server.
I've tried accessing it using both Internet Explorer and Chrome, and they both have the same problem, so I don't think it's a browser-related problem.
This stopped happening after doing more code changes and switching to IIS Express. It seems that one of the MVC views was producing an error, but for some reason the debugger wasn't picking it up and the framework wasn't producing an HTTP response.

Visual Studio 2010 displays IIS 7 page on debug instead of my project

This is my first ASP.NET project so I am a bit of a rookie when it comes to a lot of the configuring of IIS/Visual Studio so bear with me...
I am using Visual Studio 2010 running on Windows Server 2008 SR2. We recently did some updates on the server and now my project no longer loads when I attempt to debug. When I try to debug the default "Welcome" page for IIS 7 loads instead of my project. I am set up to use the development server to debug, not IIS so I don't understand why I get the IIS page. Before the updates the debugger was pulling up my page without any issues.
Any ideas? Thanks in advance!
It looks like IIS is now bound to the port number that Visual Studio Development Web Server was using previously. You can change the port number in the properties of the web site project.
I have found a solution to my issue. I decided to use IIS instead of the Development Server for debugging. After attempting to debug unsuccessfully yet again, I took a look at the identity that was being used in the application pool and I changed to one with more privileges and that seemed to do the trick. Thanks for the suggestions.
I had the same problem but non-of the earlier answers worked.
I am using Windows 7 enterprise 64-bit, IE11, VS2010, Silverlight 5
I have been developing and maintaining a number of Silverlight projects for the past 5 years, and have always been able to debug them within VS2010 using the ASP.NET Development Server. However, on returning from some well deserved holiday, I found that none of my existing Silverlight projects would run in the debugger. In each case there is a Web project set as the start-up project, and in each case on starting the project within VS2010 (with or without debugging) I got the IIS7 web page instead of my application.
I tried creating a new Silverlight web application, and found that this started normally in the ASP.NET Development Server. I checked my source code and found that no changes had been made in my absence.
After a lot of head scratching, etc., the solution was to clear the IE cache. These are the explicit steps I used:
Close all instances of IE and ASP.NET Development Server.
Open Internet Properties from the Control Panel.
Click "Delete" on the General Tab.
In the Delete Browsing History box check the following options:
a) "Preserve Favourites website data"
b) "Temporary Internet files and website data"
c) "Cookies and website data"
Leave the others unchecked
5) Click "Delete" and wait for the command to complete.
6) Close the Internet Properties box.
7) Rebuild ASP.NET project
8) Start (with or without debugging) in VS2010 - it should now load normally.
Hope this works for you.

Branched Site Deployment Problems

I have branched some code on my dev machine for an ASP.NET Webforms app. .NET 4.0.
The working copy (original) runs on IIS 7 localhost in an IIS Application.
I thoguht I would keep things simple and configured the branch site to run in Cassini. The page that rendered was a grey page with Diagnose Connection Problems button. It had a heading "Internet Explorer cannot display the webpage". Fiddler revealed a 302 reponse code. No idea why a redirect is occurring.
So, not wanting to waste time, I changed the configuration to use IIS 7, created a new IIS Application for it.
The exact same result when trying to run the app. So, the result is common, regardless of whether I use IIS 7 or Cassini.
Has anyone experienced this? Is there something I'm forgetting to configure in the application.
Cheers.
I have resolved this now. I'm not surprised that no-one answered, as this was a really weird scenario with a fix that does not obviously address the issue.
I had to do two things:
1 - delete the Global.asax and create a new one, making sure that it inherits from the Microsoft.Practices.CompositeWeb.WebClientApplication class.
2 - in the RadScriptManager (a Telerik component), change the RadScriptReferences to normal ScriptReferences.
I have no idea why these changes were required. But they worked.

Resources