ASP.NET website pages not reflecting recent changes - c#

I have been working on a new intranet site for a few weeks now, and everything has worked as expected. If I made any changes whatsoever (added raw text, new controls, etc) to my .aspx pages, and then tested them in VS(F5), all changes would be reflected immediately in the browser. Anything as simple as adding a <br> tag or as complex as adding a set of nested controls would show up upon a debug restart.
Earlier today, everything was working. Then I decided I wanted to play around a bit with some of the AjaxControlToolkit goodies. I ended up installing the SP1 Update 2 for VS that was released today (http://www.microsoft.com/en-us/download/details.aspx?id=38188) while I was at it, as well as updating NuGet and installing the AjaxControlToolkit from there.
I added a couple tools, including a ScriptManager and an UpdatePanel, and everything worked as I expected. I then went to make a few changes, and added a second ScriptManager accidentally. When I went to debug/run, it of course failed because you cannot have more than one on a page, so I removed the extra one and ran again. It again gave the same failure. I went through and made sure I didn't accidentally add another one somewhere, did a search on all files in my project and it was the only instance of it, so I commented it out and ran it again. Same thing. I tried a few things and ended up restarting IIS and VS and then the page behaved as expected.
Since that point, any changes I make in ANY of my files in the project no longer update without exiting IIS and restarting it. New, very basic aspx or html files in the project do the same thing. I then reverted to the restore point before updating VS, and used a backup of my site from earlier in the day before I added the AjaxControlToolkit, and still, the problem persists.
What is going on here? I feel like its related to the VS update, but that doesn't really seem to make sense. I can't see such a major bug being overlooked? Why isn't IIS serving the updated page?
Ctrl+F5 in browser does not reflect changes. Rebuild of entire solution does not reflect changes. Closing and reopening browser does not reflect changes. Changing my web.config does not reflect changes. Creating a brand new empty web site and the problem persists. Change to Visual Studio Development Server instead of IIS, problem persists.
The only way I have found to force the correct, updated page to serve correctly is to "Stop Site" in IIS and then restart, which is simply way too much of a hassle to check minor changes to anything in my page.
I am using Visual Studio 2012 Express, IIS Express, .NET 4.0, C# code-behind, files are on an intranet file system (mapped to x:), separate from my actual production hosting server.
Just in case (though I don't think it matters since the problem is now occurring even with a fresh web site) here is my web.config (which is very basic):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off" />
<httpRuntime />
<pages>
<controls>
<add tagPrefix="ttw" src="~/Controls/CustomerInformation.ascx" tagName="CustInfo" />
<add tagPrefix="ttw" src="~/Controls/CircuitInformation.ascx" tagName="CktInfo" />
</controls>
</pages>
</system.web>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-UA-Compatible" value="IE=EmulateIE9" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
Any suggestions would be greatly appreciated, and I hope a solution will aid others who may be experiencing the same issue after this most recent update.

Sounds like a permissions issue. Either the mapped network drive is using credentials that don't have adequate permissions or the IIS app pool identity doesn't have permissions to the folder.

Related

'The controller for path '/favicon.ico' was not found...' error

We're building an ASP.NET MVC 4 app in Visual Studio 2015. The app uses Elmah.MVC for exception handling. We're three developers; for two of us it's working fine on localhost, but one developer is getting this error (captured by Elmah):
The controller for path '/favicon.ico' was not found or does not implement IController.
This post provides a solution, and I've modified the routes to include it and the developer in question has synced his code:
routes.IgnoreRoute("{*favicon}", new { favicon = #"(.*/)?favicon.ico(/.*)?" });
Now nothing shows up in Elmah but the user continues to see a generic error:
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
What could be going on? Thanks.
Update 1: Ripped out the Elmah stuff from Web.config and just had the developer load the app. It gets into an infinite loop trying to authenticate the user, similar to this.
We're using OWIN-MixedAuth, and the issue is more than likely on the IIS Express settings. I'll have the developer try it tomorrow and confirm:
Highlight the project in Visual Studio
Open the 'Properties' panel on the right (or press F4)
Set 'Windows Authentication' to 'Enabled'
Set 'Anonymous Authentication' to 'Enabled'
As the name suggests, it's mixed auth, so both types of authentication have to be enabled.
Update 2: The OWIN-Mixed Auth issue has been fixed. Now, it has something to do with these three HTTP modules in Web.config used by Elmah:
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
When we comment them out, the one developer is able to get onto the site. What do these modules do? Why would they cause a problem?
Finally resolved the issue. We had to make two changes:
We're using OWIN-MixedAuth, and part of the issue was on the IIS Express settings (under "Development Server" section):
Highlight the project in Visual Studio
Open the 'Properties' panel on the right (or press F4)
Set 'Windows Authentication' to 'Enabled'
Set 'Anonymous Authentication' to 'Enabled'
Another part of the issue: a corrupted applicationhost.config file used by IIS Express:
Ensure you're showing hidden files in Windows Explorer.
Go to the root of your project via Windows Explorer.
Open the hidden .vs folder.
Go to config > applicationhost.config, make a backup, and open it in Notepad (Notepad++ is better).
Compare it to a working applicationhost.config file from one of our machines. We found lots of old sites that were listed in the config file which were not being used anymore.
Once cleaned up, launched the app and it worked.
Add this to your global.asax file.
routes.IgnoreRoute("favicon.ico");

ASP.NET static content always caches

I have a project that uses ASP.NET MVC 5 and angular.js
Recently (though I'm not sure when) changes to my angular.js views are not being reflected in the browser.
When I look at the developer tools in Chrome, it indicates that it is pulling it directly from cache. The Last-Modified header appears to be a couple days old and the ASP.NET server is returning 304 Not Modified for the html file.
Does anyone have any clue why my static content (specifically html files) are being cached by the browser when there are in fact changes.
What I have tried:
I have modified the Web.config like so:
<system.webServer>
...
<caching enabled="false" />
<staticContent>
<clientCache cacheControlMode="DisableCache"/>
</staticContent>
</system.webServer>
However, that doesn't seem to make any difference.
I have also checked that the file system is recognizing my changes; the "date modified" on the files are much more recent than the "last-modified" being returned by the server.
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Try this on code behind

MVC windows authentication grayed (greyed) out in project properties

I am trying to use Windows Authentication in a VS 2013, MVC 4 project that was originally done in VS2011.
It worked fine on VS2011, but when I moved to VS2013 on the same machine, using IIS 7 problems ensued.
I have windows authentication set in web.config (and anonymous authentication disabled):
<security>
<authentication>
<anonymousAuthentication enabled="false"/>
<windowsAuthentication enabled="true"/>
</authentication>
</security>
However, these attributes are grayed (greyed) out in the "f4" properties window for the VS2013 solution.
When I debug the program, I get the following error:
HTTP Error 500.19 - Internal Server Error with Error Code 0x80070021
I have tried editing C:\Windows\System32\inetsrv\config applicationHost.config per similar posts in forums, and restarting the services, but the problem still persists.
Does anyone know how to please solve this?
Thanks in advance.
What works for me is the following line in web.config -->
<system.web>
<authentication mode="Windows" />
</system.web>
It appears that upgrading an MVC project from VS 2011 to 2013 (at least if this happens) is not an easy thing to do. I finally punted and started a new VS 2013 project and imported various controllers, views, etc. into that project, which actually worked surprisingly well. If you reach this page in a search and some of the other sites with answers have been failing for you, you may wish to do likewise.

Visual Studio 2012 Register Tag Prefix "Could not complete the action."

I have the following line of code:
<%# Register %>
When I attempt to add this line of code Visual Studio informs me of this non-informative message:
"Could not complete the action."
I remove even one character from the Register statement and it gives me that message. I type "<%# Register %>" and it gives the message.
I am attempting to add this line in full:
<%# Register TagPrefix="sc" Namespace="Sitecore.Web.UI.WebControls" Assembly="Sitecore.Kernel" %>
Some additional information:
I am using Microsoft Visual Studio 2012.
The Sitecore.Kernel has been added to the references in the application.
The Kernel itself is included in the application and is set to copy local.
The application builds correctly with this line of code applied and is correctly rendered by Sitecore to the page.
The Sitecore.Kernel is usable in the C# code behind.
Update: 11/26 4:28 PM This issue is now effecting all users of the TFS Solution.
Update: 12/2 9:38 AM We created a new solution and very slowly ported our code to it. Still looking for an answer to this question in case it happens again. This seems to be more of a Visual Studio question than a Sitecore one.
Update: 12/13 4:31 PM Fully ported to a new solution. So I assume a new solution is the fix to this issue.
Update: 1/14/2014: Still no answer. Bummer
Update: 3/21/2014: I added the Tag for Knockout.js because I think the addtion of the data-bind to the ASP markup has caused this issue. It causes intellisense to go bonkers and error out. User #Jeroen is also having this issue in Visual Studio.
Here's the relevant code:
<controls>
<add tagPrefix="sc" namespace="Sitecore.Web.UI.WebControls" assembly="Sitecore.Kernel" />
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add tagPrefix="sc" namespace="Sitecore.Web.UI.WebControls" assembly="Sitecore.Analytics" />
</controls>
You could add the prefix to the config file, to make it available to other pages in the project.
<configuration>
<system.web>
<pages>
<controls>
<add tagPrefix="sc" src="~/locationofcontrol" tagName="sitecore"/>
</controls>
</pages>
</system.web>
</configuration>
Take a look here for a thorough explanation.
can you delete or rename the suo file of your solution ? Before deleted please make a backup of your file.
The solution user options (.suo) file is a structured storage, or compound, file stored in a binary format. You save user information into streams with the name of the stream being the key that will be used to identify the information in the .suo file. The solution user options file is used to store user preference settings, and is created automatically when Visual Studio saves a solution.
I know this is a bit old, but here it is.
I was having the same exact issue, and was able to resolve it on my machine. What I had was a solution with multiple projects, and I was having this issue on of the projects. After long research, deleting .suo file, resetting VS settings...etc nothing worked. The message “Could not complete the action.” was still coming up. I then thought of checking another project in the same solution, and the other project did not give me the message.
What I ended doing to fix this is:
Close Visual Studio
Deleting the projectName.csproj.user file from the project folder
Open the solution... BAM the message is gone.
Hopefully this helps you solve your problem. Best of luck
This might be a couple of years too late, but I faced a similar issue. My issue was caused because I changed my build directories; instead of the default \bin directory, I changed my build directory to some other directory. When I changed the build directories to the original directory (\bin for web applications and \bin\Release or \bin\Debug for class libraries), this error disappeared.
In order to change your build directories, right click on each project, click Properties and then click on the build tab in the properties window. Here, change the "Output path" to the correct directory listed above.
This was happening to me as well. I use the Telerik asp controls and updated to the recent control-set. Well when ever I click on a file from the solution explorer to view in the designer, that irritating dialog window just spammed the hell out of me.
I opened other web projects that do not use the Telerik controls and the pages worked fine in designer mode.
So on my Telerik-controlled project I uninstalled the recent update and reverted back to the older set and it's back to normal. No more pop-ups.
I don't know what configuration changes need to be made to use the new Telerik control set so I'll just stick to the older set for now.

Site unavailable while service status is 'running'

I recently updated my project to use SDK 2.0 and tried to publish it to staging environment. Visual studio reported success but there is nothing at the site generated URL, just a "webpage not available" or whatever is the default browser message for not existing URLs. In Azure management portal however the status is RUNNING and there is even some curve in CPU percentage chart. I updated all references in my role project to be the same as in blank new azure project for 2.0 sdk version, the only new references are added by 'Identity and Access tool' for OAuth purposes. Can anyone tell me what can be possibly wrong or how can i figure this out myself? I enabled diagnostics, but it shows 0 errors in every tab. Of course everything runs fine in my local environment
upd: my problem was actually quite simple: something went wrong with port forwarding and i had to add :8080 to url explicitly, so i removed all of my endpoints and added just a simple port 80 one with no internal port set. The accepted answer pointed me the way to discover this problem
Visual Studio and Azure Management Portal only report that the server is up and running. They have no way of knowing if there is an actual issue with the code or deployment.
Webpage not available is not the same as 404 nor is it the same as dns not found. Webpage not available usually means a server error of some kind. Most likely some .DLL's are missing from deployment
If you are running on WebRoles, you can RDP into the server and look into the Windows Event viewer to see if any errors occur
Alternatively, you can turn off custom errors via web.config (check this link out for sample directions: http://www.serverintellect.com/support/programming/custom-errors.aspx )
At the end of the day, you need to find out what is the real cause of the issue
Make sure you have the following in your web.config. Mine is added just before the line
<customErrors defaultRedirect="GenericError.htm" mode="Off">
<error statusCode="500" redirect="InternalError.htm" />
</customErrors>
If you are using web.config transforms and have a web.debug.config you add the following code to it:
<customErrors mode="Off" defaultRedirect="GenericError.html" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
You still have to make sure you have a custom errors section in your web.config for the replace to happen.

Categories

Resources