VS ASP.NET 500 Server Error - asp.net

Hey guys, I'm having a super weird problem with my VS 2008 solution.
We had this hand-coded ASP.NET compiled web app on our old IIS6/Win2003 server, working great, moved it to our new IIS7/Win2008 server, still working great, but when I try to compile the application and publish it again to our new Win2008 server, I get server 500 errors. It's ASP.NET 2.0 with AJAX extensions and AJAX control toolkit.
I'm not too great with server issues, or even sure if it is a server issue but here are some more symptoms... ?
I know the website works (it only differs by some minor code fixes) and can use it's code on a development machine, there are no errors, and it publishes fine. Publishing (using the DLL files), and even not publishing and trying to use the code-behind files on our new server, both no success. The old website does work on the new server just fine.
If I put a simple hello world html page in the website's virtual directory, with the old code, it works fine, but with the new code, that html page gets the 500 error. And in fact, oddly, I can add all the files to the website, only when I add the web.config, do I get the 500 error. The web.config has not changed.
Tried stopping and restarting IIS
What's the problem, here? Any ideas, what else can I do to troubleshoot the problem?

Check what IIS7 is running under .NET 2.0 or .NET 3.5?

Its tough to see without being there, have you checked which App pool the server is running the site on? (default should be OK, I have found some to be set to classic which causes problems with the AJAX control toolkit)
Also you could try aspnet_regiis -i (if the server is 64 bit make sure you run the one under the 64 bit version of .net)

It was a IIS 7 to 8 issue.
Both machines have different assemblies that need to be just-so on the web.config, in addition with IIS7 web.config changes to make AJAX happy (it has new XML sections).

Related

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.

Issues with precompiled website and server control (parser error)

I am deploying our system to a brand new server that was previously untouched and having serious issues with .NET (the error points to server controls but i think this is a symptom rather than the problem)
Basically the VB6 code seems to work correctly but when moving over to the .NET I keep getting a parser error when loading the server control.
Like this
Im quite sure that the server control isnt the issue and there isnt an issue with the compiled code. I have copied the code over from a working deployment on another server.
The code is organised as a WebSite rather than Web Application
The control is referenced at the top of the aspx page like so
<%# Register Namespace="CustomWebControls" TagPrefix="Fastrack" %>
CustomWebControls is in the App_Code folder and is compiled into App_Code.dll
I think there is some issue with windows or IIS config stopping the reading of the compiled app_code.dll file. I have checked user permissions and allowed all to access i have manually copied over the dlls to the asp temp folders.
Other things tried
reinstalled IIS
reinstalled .NET
checked web and machine.config files against known working ones
checked iis installed components are correct
I'm completely out of ideas with this one and I'm not sure where to go next.
The stack trace disappears off deep into System.Web.UI and doesn't hint at any issues with our code at all (doesn't even seem its getting as far as loading it)
Platform
Windows 2008 R2
IIS 7
.NET 4
ASP.Net webforms
If anyone has any suggestions or would like some more info from me let me know.
After much ripping out of hair and sleepless nights the anser was a missing precompiledApp.config file!
The hardest ones often have the simplest answers!

404.17 error - requested content appears to be script

I have a similar question to this one;
IIS 7.5
Server 2008
ASP.Net 4.0 web site
The error I get when trying to run the site is this:
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
...
Most likely causes:
The request matched a wildcard mime map. The request is mapped to the static file handler. If there were different pre-conditions, the request will map to a different hander.
Now here comes the weird part:
THE WEIRD PART
The weird part is that on the develop server -- which is similar in every aspect to the production server -- everything runs smoothly.
Here's a list of things I cannot try, because I don't want to mess with the sever (it hosts many other sites):
Reinstalling .Net
Reinstalling IIS
Reinstalling anything
Running aspnet_regiis
Here's what I did try:
Republishing the site
Restarting the application pool
Changing the application pool to .Net 2.0 and back to .Net 4.0
Switching around between Integrated and Classic pipeline mode
Enabling 32-bit mode
Taking a look at Handler Mappings
Eventually I created a new application pool, and it sort of started working.
Q) "Sort of"?
A) Yes, sort of.
Now the site only works when the (new) app pool is set to .Net 4.0, Integrated,
and the site's Authentication has ASP.NET Impersonation set to Disabled.
Any change to these settings sets the server yelping "404.17" all over again.
Q) What's wrong with that?
A) What's wrong with that is that I NEED ASP.NET Impersonation for the site to function properly.
As always, your guidance is most needed.
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
Usually this error occurs when you have the right IIS version installed to the respective .net framework. If it was a version (not installed) issue then you would have got a different error message. Anyways, I think by now you have resolved your matter, but I like to share some words with anyone else having this problem. These error messages gave me so much headache all last week and I had tried everything.
Best remedy is always to re install the latest .net in latest visual studio. And the important thing to do is uninstall the existing IIS(express or whichever you have) and re install it first. Then download the latest visual studio. This way visual studio installation can easily access you IIS and add the necessary application pool.
As for the error 404.17, it could simply be because the right application pool has not been assigned for the appropriate dot net version. If the right version is not there re installing visual studio is the only way I know. Also, I think you can try downloading another version of the Visual Studio too. For eg, download the ultimate if you have professional or vice versa. Hope this helps someone with similar problem.
Installing this windows server feature http activation is, what was missing for me.

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.

Am running the web allication using asp.net.am getting this error

HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /webctrl_client/1_0/treeimages/Rminus.gif
I had this problem for a simple reason. Make sure you compile your site before deploying it. I had some pages that were compiled and some pages that were not compiled. And because I was testing on a Windows Server 2008 box, not a Windows 7 box.
It took me so long to figure out because when I tried viewing these pages on the application server (Windows Server 2008), it wouldn't let me view a non secure page (http protocol), because of Internet Explorer's security settings. I only had a binding for port 80 when testing on a browser on the server box. So I couldn't even see the aspx page that was compiled, let alone the aspx pages that were not compiled. A plain HTML page was visible on both boxes however, on the same site--that part was interesting. So that told me IIS was running fine. When I viewed the pages on another machine (running Windows 7) on that network, the compiled aspx page showed up fine because it was compiled. And the non-compiled pages did not.
Here are other possible issues:
(use correct version of .NET framework for commands below)
1.) Have you installed the .NET framework?
2.) Make sure ASP.NET 4.0 is registered. Run these commands to verify.
"%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe" -lv
"%systemroot%\system32\inetsrv\appcmd.exe" list apppool /managedRuntimeVersion:v4.0
"%systemroot%\system32\inetsrv\appcmd.exe" list config -section:system.webServer/isapiFilters
If not, run this:
"%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis" -i -enable
3.) Make sure the ISAPI filters are turned on for the version you are using. Click server (not the site) in IIS 7. Then go to "Isapi Filters". Allow the ones you need.
4.) Make sure your application pool is running in the version of your compiled source code of your ASP.NET pages. Go to Application Pools in IIS, then right click the application pool for your site, and choose Advanced. Change the version to either 2.0 or 4.0. Make sure it's also 32 bit if you compiled your app as 32 bit.
... when reading forums those are the 4 solutions I came across most frequently. Mine was a bit simple, but confused me for hours because I hadn't installed the SSL certificate yet.

Resources